Results 1 to 6 of 6
  1. #1
    mesab66 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jun 2015
    Posts
    3

    save-previous-next facility

    I have a user-form whose job is to gather various search criteria entered by the user, construct an SQL query then perform the search on the main database. Various switches are included to allow fine tuning of the search process.
    The main search criteria is stored in the table table tblSrchCrt (comprising 3 fields of user-entered search data).

    tblSrchCrt:



    Click image for larger version. 

Name:	Capture.JPG 
Views:	9 
Size:	24.1 KB 
ID:	21112


    What I’d like to do is have the ability for the user to recall previous search criteria thus enabling the ability to further amend existing search criteria (if the current criteria needs to be amended at a later date). The actual criteria is much larger than this example, so this facility would be handy. Additionally, I’d like the switch states (Boolean yes/no primarily) to be saved also.

    To facilitate this, I’m thinking about adding ‘Save’, ‘Previous’ and ‘Next’ buttons, then coding as appropriate underneath the buttons.
    I could replicate tblSrchCrt manually, say, 20 times to allow for a history of 20 search criterias…adding a number between 1-20 to the table name then navigating between tables using the number as a pointer.

    Is there a more standard way to do this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why would you replicate tblSrchCrt? Why not just 1 table?

    I have a search procedure that saves the filter criteria as a text string into a table and that table is displayed in a listbox. But your approach is probably just as reasonable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mesab66 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jun 2015
    Posts
    3
    Thanks for the reply,
    Replicating the criteria table, tblSrchCrt, 20 times does look a bit daft. What I think should have said was create 3x20 fields in tblSrchCrt and cycle through each criteria history (block of 3 fields) using a suitable numeric increment (as the pointer) added to each block of 3 field names (I'm building the SQL query within VBA)...achieving the same thing in one table. Again, I'd be looking to include a few other items e.g. switch states.

    However, I was wondering if there's a more standard/acceptable approach (not being too db savvy myself)? I'd guess there's many approaches dependent on what's being saved.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    I'd guess there's many approaches dependent on what's being saved.
    I do what June7 does - main benefit is that it is not limited to one scenario - the 'routine' can then be used anywhere, whereas yours is very specific to a single form/recordsource with specific criteria elements. You can also easily extend the functionality to include say a userid so the list can be displayed unique to a user.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why would each search need its own set of 3 fields? Similar name fields indicates non-normalized data structure. Seems to complicate storing and retrieving.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    mesab66 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jun 2015
    Posts
    3
    Thanks June7...penny finally dropped re converting to string

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Facility Look-up Database Creation
    By GeorgeW in forum Database Design
    Replies: 1
    Last Post: 03-06-2014, 05:54 AM
  2. Replies: 15
    Last Post: 01-28-2014, 12:20 PM
  3. Replies: 5
    Last Post: 08-01-2012, 03:36 PM
  4. Replies: 7
    Last Post: 10-28-2011, 03:42 AM
  5. Search Facility
    By omegaboy in forum Access
    Replies: 3
    Last Post: 05-21-2009, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums