null value

D

Desert Bear

I have the following code. MgrID is an auto number ID field.

Dim lngMgrID As Integer ' holds new person's MGR ID for tblEval
lngMgrID = Form_frmAddPerson.cboSelectManager.Value

If the user has NOT selected a name from cboSelectManager, the user gets "Invalid Use of Null"
I'd like to check lngMgrID for null or zero and print "User must select a manager. It can be changed later."
 
P

Pavel Romashkin

Try

Dim lngMgrID As Integer
if IsNull(Form_frmAddPerson.cboSelectManager.Value) then
msgbox "User must select a manager. It can be changed later."
else
lngMgrID = Form_frmAddPerson.cboSelectManager.Value
end if

Cheers,
Pavel
 
S

Stephan Kassanke

Desert Bear said:
I have the following code. MgrID is an auto number ID field.

Dim lngMgrID As Integer ' holds new person's MGR ID for tblEval
lngMgrID = Form_frmAddPerson.cboSelectManager.Value

If the user has NOT selected a name from cboSelectManager, the user gets "Invalid Use of Null"
I'd like to check lngMgrID for null or zero and print "User must select a
manager. It can be changed later."

If isNull(Form_frmAddPerson.cboSelectManager.Value) then
lngMgrID = Form_frmAddPerson.cboSelectManager.Value
else
msgbox (".....")
en if


By the way: auto number is a long value, so dim you lngMgrId as Long.

cheers,
Stephan
 
S

Stephan Kassanke

Stephan Kassanke said:
a
manager. It can be changed later."

If isNull(Form_frmAddPerson.cboSelectManager.Value) then
lngMgrID = Form_frmAddPerson.cboSelectManager.Value
else
msgbox (".....")
en if

Sorry, it's the other way round:
If isNull(Form_frmAddPerson.cboSelectManager.Value)=false then
lngMgrID = Form_frmAddP...

Stephan
 

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