Retrieve record from Combo Box to update the record.

pmullan

Registered User.
Local time
Today, 13:34
Joined
Jul 28, 2017
Messages
25
Hello Everyone,
I am currently stuck in a predicament and need help. I am a new acess/vba programmer and I am currently working on a Shift Turnover DB for work. I am at the part where I am using a form (tied to a "Tasks" table via VBA). This form has two sections; 1st section is where the task gets created and then saved. 2nd section is where the person who completed the task, searches for their task and then populate the form with the record. Once the record has been populated to the form, the user can then update the form with what they did and then update the record.

My problem is that I am having issues getting the record retrieval / form population piece of VBA code to work. I am trying to use a Combo box to locate the desired record, which appears to work. However, when I click on the record that I need to retrieve, I keep getting errors.

I would appreciate some help with this as I have been working this issue for over 3 days with no break thru yet. Thank you Patrick
 
Hard to debug code when you can't see it. ;)
 
Uncle Gizmo, It comes close to what I am trying to accomplish. I am using the combo box only to locate the record I need and then once the form is populated with the correct information, the combo box is again set to empty. I am going to check out the NW DB's order form for that combo box and check out the code. Thank you.
 
If the form is based on a table, have you tried adding a combo box with the wizard, choosing the third option "find a record..."?
 
Hello pbaldy, I did try using the control wizard. Here is the code that is currently in the "AfterUpdate" procedure.

Private Sub cboFindTask_AfterUpdate()

' Sets the Acknowledged Task text box to Yes.
Me.txtAcknowledged.Value = "Yes"

' Shows all records from the tasks query based on the task ID
DoCmd.ShowAllRecords

' Sets the focus to the Task ID Text box
Me!txtTaskID.SetFocus

' Locate the desired record from the record selected in the combo box.
DoCmd.FindRecord Me!cboFindTask.Value

' Set value of combo box equal to an empty string
Me!cboFindTask.Value = ""

End Sub

Right now, I get a runtime error "2162".
 
That's different, it used to use a bookmark. What line errors, and what's the text of the error?
 
Pbaldy, I have to do this in multiple post due to character limits.
 
Unfortunately, due to the character limits, I can't even attach a document to the post because it keeps stating that I am exceeding the 25,000 limitations.
 
When you click on debug it should take you to the offending line.
 
Sorry, did not realize the "Highlight" was gone from the line. Here is the line;

DoCmd.FindRecord Me!cboFindTask.Value
 

Users who are viewing this thread

Back
Top Bottom