IsNull Problem

  • Thread starter Thread starter Paul Scott
  • Start date Start date
P

Paul Scott

Hi all,

I have a form with a subform and a button that's on the
subform. When clicked a work order sent. But before the
work order is sent it checks to make sure all fields are
filled.

I have a client name field that's part of the main form.
The problem I'm having is the work order sends even if
the client name field is not filled.

The main form is named: frmBedRepairEntry

The sub form is name: frmBedRepairEntrySub

I'm using the following code:

If IsNull(Form_frmBedRepairEntry!cboClientName) Then
MsgBox "You need to select a client who need their bed
repaired.", vbOKOnly
Form_frmBedRepairEntry!cboClientName.SetFocus

I'm using sql 2000 and access 2002.

Can anyone tell me what I'm doing wrong?

Thanks,

Paul
 
Paul Scott said:
Hi all,

I have a form with a subform and a button that's on the
subform. When clicked a work order sent. But before the
work order is sent it checks to make sure all fields are
filled.

I have a client name field that's part of the main form.
The problem I'm having is the work order sends even if
the client name field is not filled.

The main form is named: frmBedRepairEntry

The sub form is name: frmBedRepairEntrySub

I'm using the following code:

If IsNull(Form_frmBedRepairEntry!cboClientName) Then
MsgBox "You need to select a client who need their bed
repaired.", vbOKOnly
Form_frmBedRepairEntry!cboClientName.SetFocus

I'm using sql 2000 and access 2002.

Can anyone tell me what I'm doing wrong?

Thanks,

Paul

Instead of
If IsNull(Form_frmBedRepairEntry!cboClientName) Then

Try this:

If IsNull(Me.Parent!cboClientName) Then

That should work and be simplest because you're using an existing
reference to the subform's parent form. The following alternative
should also work:

If IsNull(Forms!frmBedRepairEntry!cboClientName) Then

But I believe my first suggestion is better.
 
Back
Top