RecordSource Problem

liza_adam

New member
Local time
Today, 23:02
Joined
Dec 9, 2002
Messages
6
First. Thanks for you help.
I’m trying to change the RecordSource depending on Unbound filed and my code is like this:

Private Sub awb2_AfterUpdate()
Dim strNewRecord As String
strNewRecord = "SELECT * FROM Employees " _
& " WHERE AWB = '" _
& Me!awb2.Value & "'"
Me.RecordSource = strNewRecord
End Sub

And when I try it I have this message error:

Run-time error ‘2001’
You canceled the previous operation.

I don’t know what is the meaning of that and what should I do. I already tried this code before and it was OK.
 
It looks like you are selecting a specific record to display in your form. Instead of changing the Record Source of the form you can use the Wizard to create a combo box that will let you select the employee data that you want and the correct record will be displayed in the form. To do this create a combo box using the Wizard and on the first screen of the Wizard select the 3rd item, "Find a record...". Finish the Wizard. Now you will be able to start typing into the combo box or scroll to the record you want and then the complete record will be displayed on the form.

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom