Results 1 to 6 of 6
  1. #1
    JMac is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    21

    Running Query on only 1 row of table.. Criteria?

    Hi All
    I want to avoid updating the entire table when running a query.

    Basically the front page form of my DB is a series of drop down lists which populate a table, thats easy.
    When the user has chosen each drop down field I ask them to press a command button which runs a query that adds (&) all their choices for the specific record into the nominated column, I have completed this sucessfully...

    However, it performs the query on every record in the table and after a while, when the DB is large, I suspect this would become a little difficult to handle.

    My thoughts are it should be a criteria statement limiting it to work on only the last record but Im unsure of the expression to use...
    Any thoughts??

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, use WHERE clause in the SQL statement.

    What do you mean by 'all their choices for the specific record into the nominated column'? Are you saving multiple data as a single string to a single field?

    Why is it necessary to run an UPDATE query if you only want the data in the current record?

    Do you want to provide project for analysis? Follow instructions at bottom of my post.
    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
    JMac is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    21
    There are 5 boxes on the form, each with a drop down choice, from look up tables containing 6 items plus an auto number. (these look up tables will eventually have more options which is why they are seperate)
    When the user picks or rather populates all the 5 drop down boxes on the form (plus autonumber) I want to fix those 5 choices + 1 auto number and enter the result it into the 7th column... and thats the new record
    So
    Drop down look up box 1 options are: Black, Green or Red
    Drop down look up box 2 options are: Extra large, Large, medium or Small
    etc etc
    They make the choices then press the Save button (which runs the query) and that record is stored

    So the format of the query for choices Green + extra large + etc etc = GXL+(Autonumber)
    And this is saved as a unique record...
    Then the next entry is a new record and may well be the same but its got an incremented autonumber making it unique...

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You want to create a unique ID with the choices of the 5 comboboxes? The comboboxes are bound to fields of form RecordSource? So you are saving not only the individual choices in each field but also the composite ID? Not something I would do.

    If the form is bound to the table you want this record created in, then saving the composite ID could be as simple as:

    Me!fieldname = Me.cbo1 & Me.cbo2 & Me.cbo3 & Me.cbo4 & Me.cbo5
    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.

  5. #5
    JMac is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    21
    You want to create a unique ID with the choices of the 5 comboboxes? Yes, however they can never be duplicated which is why the autonumber is also added in
    And this unique ID needs to be printed out, attached to the item physically and recognized visually whilst not containing every bit of info. The full details will be entered into another form which will then in future be able to be ammended, which is why I want to keep the part number table separate.

    The comboboxes are bound to fields of form RecordSource? Each combo box is linked to its own separate table which displays the descriptions but embeds a code (second column) rather than the full description, each of these look up tables will grow in size over time

    So you are saving not only the individual choices in each field but also the composite ID? Yes, because there are multiple items of the same spec, so I need a visual identifier firstly but something which distinguishes between similar items also. The ID is created to only be used to identify, that unique ID will then be used in a more comprehensive table with the exact details of the item...


    If the form is bound to the table you want this record created in, then saving the composite ID could be as simple as:

    Me!fieldname = Me.cbo1 & Me.cbo2 & Me.cbo3 & Me.cbo4 & Me.cbo5 Would this work if the incremental autonumber is added on the end to get 'uniqueness'?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes. Might have to save the record before can reference the generated autonumber value.

    DoCmd.RunCommand acCommandSaveRecord

    And if it is the description in second column of each combobox that you want (column index starts with 0):

    Me!fieldname = Me.cbo1.Column(1) & Me.cbo2.Column(1) & Me.cbo3.Column(1) & Me.cbo4.Column(1) & Me.cbo5.Column(1) & Me.ID
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 03-02-2012, 12:33 AM
  2. Running a make table query
    By rohini in forum Forms
    Replies: 5
    Last Post: 02-22-2012, 11:32 AM
  3. Replies: 10
    Last Post: 11-06-2011, 01:30 PM
  4. Running a query or table in a form
    By Katherine in forum Forms
    Replies: 1
    Last Post: 08-17-2011, 09:12 AM
  5. Query Criteria from another table?
    By gmontano in forum Queries
    Replies: 1
    Last Post: 08-30-2010, 11:51 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