Results 1 to 5 of 5
  1. #1
    Grant Shea is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    30

    Editing a field using vba onclick


    I have a form that has 3 combo boxes that sets the criteria for a query. At the bottom of this form is a button. What i would like to happen is when i click the button it updates the Yes/No field associated with the record matching the three combo boxes to Yes without opening the table.

    I have included two attachments one is the "Invalidate Form" which contains the lookup combo boxes and the button i would like to use to invalidate the question.

    The second attachment is the "Questions" table which contains all the records.

    Thanks,
    Attached Thumbnails Attached Thumbnails QuestionsTable.jpg   Invalidate Form.JPG  
    Last edited by Grant Shea; 08-30-2016 at 08:06 AM. Reason: solved

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    The button click would run your update query using a macro.
    in the macro run OPENQUERY.

    the query uses the items on the form...
    update table set [field] = forms!frmMyForm!cboRound

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Are your combos dependent on each other? If your tables are structured correctly and the combos are dependent, it should be as easy as building a query that uses the last combo as criteria.

    Have you tried building a query object using the designer? You could use the Update tool within the designer and include your combo name in your query. Granted, you have to have the corrected Bound Column property for your combo.

  4. #4
    Grant Shea is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    30
    I figured it out i changed the underlying "question selection query" to an update query and inserted a docmd.runquery line in the on click field for the button.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Glad to hear you are managing to work through these types of issues. I would like to reemphasize a point. Make sure that you include the appropriate criteria. Perhaps you need to include the value of more than one combo.

    The UPDATE statement is powerful and irreversible. The UPDATE query is unmatched in its capability of creating memorable events on a resume.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-28-2016, 04:37 PM
  2. Replies: 3
    Last Post: 04-07-2015, 10:37 AM
  3. OnClick increase number in field on form
    By DCV0204 in forum Forms
    Replies: 1
    Last Post: 07-25-2014, 11:02 AM
  4. Replies: 3
    Last Post: 10-19-2013, 10:21 AM
  5. Clear a Field OnClick
    By eww in forum Forms
    Replies: 3
    Last Post: 08-19-2010, 01:55 PM

Tags for this Thread

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