error message

adamides

New member
Local time
Today, 11:33
Joined
Dec 30, 2001
Messages
8
Hello,
I have the following code in a form with a dropdown menu
--
Private Sub Combo0_AfterUpdate()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "MaleFrm"
stLinkCriteria = "[MaleAnimalCode]=" & Me![Combo0]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
--
When I run the form I get the following error message >>
"Runtime error 2501 - The openform action was cancelled"
<><><><
Basically what I am trying to do is to use a combo box in that form to select the MaleAnimalCode and based on that to retrieve data from the table 'HeGoats' which I have in the form 'MaleFrm'.
What does that error message mean? How can I fix it?
Thank you for your time
 
stLinkCriteria = "[MaleAnimalCode]=" & Me![Combo0]

The above is wrong, the above should match ie

stLinkCriteria = "[MaleAnimalCode]=" & Me![MaleAnimalCode]

To link the two together the two have to match and cannot be different.
 

Users who are viewing this thread

Back
Top Bottom