identify code error 2

N

Nancy

Daniel and Rick responded to my first question -- identify code error. I
made the change as both suggested. Now I don't get an error message but it
doesn't work. What I am trying to do is have the WorkshopLocation field
automatical fill when the user selects the Seminar ID and tabs to the next
field. The afterupdate event procedure is linked to the Seminar ID. What
else am I doing wrong?
 
R

Rick Brandt

Nancy said:
Daniel and Rick responded to my first question -- identify code error. I
made the change as both suggested. Now I don't get an error message but it
doesn't work. What I am trying to do is have the WorkshopLocation field
automatical fill when the user selects the Seminar ID and tabs to the next
field. The afterupdate event procedure is linked to the Seminar ID. What
else am I doing wrong?

Your code is referring to (a variable I assume) named varSeminarID. Where is
that variable being set because it is not set in the code you posted.
 
N

Nancy

I guess that's what I'm failing to do. How do I set that variable. At this
point it is just another field in the same table/query that is the source for
the form.

Thanks for your prompt reply. Hope you can do it again. And, I'm sorry to
be so ignorant.
 
R

Rick Brandt

Nancy said:
I guess that's what I'm failing to do. How do I set that variable. At this
point it is just another field in the same table/query that is the source for
the form.

Then just use the name of the field...

Me!FieldName

....instead of varSeminarID
 
N

Nancy

This is what my code looks like now:

Private Sub SeminarID_AfterUpdate()

If Me!SeminarID = "070226WMel" Then
WorkshopLocation = West_Melbourne

ElseIf Me!SeminarID = "070227Orl" Then
WorkshopLocation = Orlando
ElseIf Me!SeminarID = "070228Gai" Then
WorkshopLocation = Gainsville
ElseIf Me!SeminarID = "070301Sar" Then
WorkshopLocation = Sarasota
ElseIf Me!SeminarID = "070302Tam" Then
WorkshopLocation = Tampa

End If
End Sub

It still doesn't work. When I tab to the next field after SeminarID on the
form, the WorkshopLocation does not fill. In the properties of SeminarID, I
have the event procedure set to AfterUpdate. Am I stupid or what?
 
R

Rick Brandt

Nancy said:
This is what my code looks like now:

Private Sub SeminarID_AfterUpdate()

If Me!SeminarID = "070226WMel" Then
WorkshopLocation = West_Melbourne

ElseIf Me!SeminarID = "070227Orl" Then
WorkshopLocation = Orlando
ElseIf Me!SeminarID = "070228Gai" Then
WorkshopLocation = Gainsville
ElseIf Me!SeminarID = "070301Sar" Then
WorkshopLocation = Sarasota
ElseIf Me!SeminarID = "070302Tam" Then
WorkshopLocation = Tampa

End If
End Sub

It still doesn't work. When I tab to the next field after SeminarID on the
form, the WorkshopLocation does not fill. In the properties of SeminarID, I
have the event procedure set to AfterUpdate. Am I stupid or what?
You need quotes around those values otherwise the code will assume they are
field names or variable names. "Orlando", "Gainsville", etc..
 
N

Nancy

It works! Thank you both for your help and your patience and promptness. I
really appreciate it.
 
Top