Assigning values in code

M

Mike

Hello all, I have the following code in the beginning of an event.

Private Sub LocationID_Exit(Cancel As Integer)
Dim Cury As Integer
Dim Curx As Integer

Dim stDocName As String
On Error GoTo Err_LocationID_Exit

Curx = Nz(DMax("[StopNumber]", "LoadStops", "[id]=" & Forms!loads![ID]), 0)

It errors on an if then statement involving the value of Curx. When I type
"? Curx" in the immediate window I get a blank line. When I type "?
Nz(DMax("[StopNumber]", "LoadStops", "[id]=" & Forms!loads![ID]), 0)" there
I get 0 which is correct for the data in the form.

Why does it not correctly assign the value? I am a newbie at code so please
be gentle.

Mike
 

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

Top