fearmichaele
Registered User.
- Local time
- Today, 05:32
- Joined
- Jan 14, 2014
- Messages
- 34
Hello fellow VBA users. i have a dilemma. I have a relational database that is SQL tables on the back end and Access 2016 on the front end. This is an equipment database that I have been tasked with updating functionality. This problem was not a problem until yesterday. i have a form that allows me to look at a location in my facility. i am using a drop down box to choose the location i want to see. the actual numeric primary key is brought down behind the description the user sees. after a new location is chosen an Afterupdate VBA is used to look up the new location and display it on the screen. This code has been working for several weeks now until yesterday. Now when i change the desired location in the drop down (search) box, the code keeps firing on location not found routine. I have not changed this code with the exception of adding error handling routine and it is not throwing an error. Is there something i am not seeing. my code is below. any input is greatly appreciated.
I have used this in other databases without any issues. what am i missing.
1 the user opens the form.
2 the user chooses the location from a dropdown box (the drop down data is pulled from a query built in the form with LocationPK as the primary key)
cboSearchByOffice is the unbound text box the information is displayed.
3 the chosen location is supposed to display information about that location on the form.
Code:
Private Sub cboSearchByOffice_AfterUpdate()
On Error GoTo Errhand1
Dim msg, title, response
Dim criteria As String
criteria = "[LocationPK] =" & Me.cboSearchByOffice.Value
MsgBox (criteria)
msg = "Location not found"
title = "ATTENTION!!!!!"
With Me.RecordsetClone
.MoveFirst
.FindFirst criteria
If .NoMatch Then
Beep
response = MsgBox(msg, vbOKOnly, title)
Else
Me.Bookmark = .Bookmark
End If
End With
GoTo Finish
Errhand1:
MsgBox Err.Number & " " & Err.Description
Resume Next
Finish:
End Sub
I have used this in other databases without any issues. what am i missing.
1 the user opens the form.
2 the user chooses the location from a dropdown box (the drop down data is pulled from a query built in the form with LocationPK as the primary key)
cboSearchByOffice is the unbound text box the information is displayed.
3 the chosen location is supposed to display information about that location on the form.