Workaholic
08-20-2004, 06:21 AM
Private Sub cmdFeedSub_Click()
If IsNull(txtfirstname) Or IsNull(txtsecondname) Or IsNull(txtteam) Or IsNull(txtRegion) Or IsNull(txtsupport_id) Then
Me.lblRed1.Visible = True
Cancel = True
Else
Me.lblGreen.Visible = True
DoCmd.RunCommand acCmdSaveRecord
End If
Can anyone tell me why this statement won't go by the first part.
Cheers
Mile-O
08-20-2004, 06:31 AM
What error message are you receiving?
KenHigg
08-20-2004, 06:31 AM
If IsNull(me!txtfirstname)
???
ken
Workaholic
08-20-2004, 06:34 AM
No matter if the conditions are met or not it still only executes the first part.
Workaholic
08-20-2004, 06:35 AM
So there is no error message but the criteria fails to work. I can't see why this is the case
maxmangion
08-20-2004, 06:39 AM
are you sure that the fieldnames are all spelled correctly ?
There aren't enough brackets around all the Or conditions, it's much easier to have them as separate statements.
I didn't think Cancel=True was available for command buttons either?
KenHigg
08-20-2004, 09:43 AM
Rich - Did I miss something obvious with:
If IsNull(me!txtfirstname)...
???
ken
No, although I prefer the dot to the bang I think the statement should look more like
If ( IsNull(txtfirstname) Or IsNull(txtsecondname) Or IsNull(txtteam) Or IsNull(txtRegion) Or IsNull(txtsupport_id)) Then
KenHigg
08-20-2004, 11:21 AM
No, although I prefer the dot to the bang I think the statement should look more like
If ( IsNull(txtfirstname) Or IsNull(txtsecondname) Or IsNull(txtteam) Or IsNull(txtRegion) Or IsNull(txtsupport_id)) Then
But where is the me. in IsNull(txtfirstname)? Do you not need it?
ken
Mile-O
08-20-2004, 11:26 AM
Remove Cancel = True - it shouldn't, as Rich says, be there.
You can replace it with Me.Undo