If Statement Help Needed

D

Dave

I have a main form Named TimeCards with a sub-form on it named
FTimeBillingSub
on the sub-form there is a control named BillPer
If this control isnull ,then I need a message box to show the below.
I tried the code below, but of course it didn't work.


If IsNull "Forms!FTimeBillingSub!BillPer Then
MsgBox "Job Has Not Been Invoiced Yet"
End If
 
L

Lynn Trapp

A subform is actually a control on the Form object of your main form. Try
referencing it this way:

Forms!TimeCards.Form!FTimeBillingSub!BillPer
 
J

Jim Allensworth

I have a main form Named TimeCards with a sub-form on it named
FTimeBillingSub
on the sub-form there is a control named BillPer
If this control isnull ,then I need a message box to show the below.
I tried the code below, but of course it didn't work.


If IsNull "Forms!FTimeBillingSub!BillPer Then
MsgBox "Job Has Not Been Invoiced Yet"
End If
Try this...

If IsNull ("Forms!FTimeBillingSub!BillPer") Then
MsgBox "Job Has Not Been Invoiced Yet"
End If

- Jim
 
D

Dave

Ok, that worked , but trying to make it also use a second criteria also.
If Is Not Null StartDte as second criteria, but it does not work with the
added criteria?

If IsNull(Text362) And IfNot Is Null (StartDte) Then
DoCmd.RunMacro "macropopup"

'MsgBox "Job Has Not Been Invoiced"
End If
 
D

Dave

Need also second If Condition to work, tried this code below, but with no
success.

If IsNull(Text362) And (StartDte) Is Not Null Then
DoCmd.RunMacro "macropopup"

End If
 
G

grep

How about,

If (IsNull(Text362) And Not IsNull(StartDte)) then
DoCmd.RunMacro "macropopup"
End If

grep
 
J

John Spencer (MVP)

IsNull(X) returns either True or False. So test for that.


If IsNull(Text362) = True And IsNull(StartDte) = False Then
DoCmd.RunMacro "macropopup"

End If
 
J

Jim Allensworth

Ok, that worked , but trying to make it also use a second criteria also.
If Is Not Null StartDte as second criteria, but it does not work with the
added criteria?

If IsNull(Text362) And IfNot Is Null (StartDte) Then
DoCmd.RunMacro "macropopup"

'MsgBox "Job Has Not Been Invoiced"
End If

The If Condition part should only have an If at the start...

If IsNull(Text362) And Not IsNull (StartDte) Then


[also you had an error in the second IsNull]

- Jim
 

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