common code sequence

G

Guest

This is in reference to a previous post "Bypassing Update" on 3/25. I copied
the code from the control to a sub in the general declarations section and
then called it from the On Current event of the form. When I open the form I
get an error message:
"The expression On Current you entered as the event property setting
produced the following error: Member already exist in an object module from
which this object module derives."
What am I doing wrong?
Below is my code:

Private Sub LastLocation()
If IsNull(DLookup("Odometer", "qryLastLocation")) Then
Me.LastOdometer = DLookup("BeginningOD", "tblTrucks", _
"TruckID='" & Me.TruckID & "'")
Me.LastLocation = DLookup("BeginningLocation &', ' &
BeginningState", _
"tblTrucks", "TruckID='" & Me.TruckID & "'")
Else
Me.LastOdometer = DLookup("Odometer", "qryLastLocation")
Me.LastLocation = DLookup("Location", "qryLastLocation")
End If
End Sub

Thanks for your help!
 
G

Guest

You probably still got an object on the form named LastLocation, either
change the object name or the sub name.
 
G

Guest

Thanks! That was the same name as a control.

Ofer Cohen said:
You probably still got an object on the form named LastLocation, either
change the object name or the sub name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

variable value not carrying through 2
Compile Error: label not defined 2
DMax/DLookup help 3
Validation code 4
Access Can't Get Dlookup To Work 1
Validation incorrect 5
entry validation 2
DLookup not recognizing variable 3

Top