null value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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."
 
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
 
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
 
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
 
Back
Top