Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'If IsNull' on a (Query)subform

Status
Not open for further replies.

namdam13

Technical User
May 20, 2009
7
Hi People,

I can not work what i am doing wrong here. I have a subform with on textbox on it. The two forms are linked.

The subform it is generated from a query from the main form.

I want it to run one macro if their is a value in the subform textbox and to run another macro if the value is Null.

I have tried several way of writing the reference but it always acts as if there is a Null value. Which i assume means its not finding the TextBox(or should that be control box properly.

After a bit of research i found the format as listed in the code below and got the following error meassage.

"Object doesn't support the propety or method"

Where am i going wrong? is there an cleaner way to do this??

Code:
Private Sub Create_New_TWC_BT_Click()

Dim stDocName As String
On Error GoTo Err_Create_New_TWC_BT_Click

DoCmd.SetWarnings False

'Forms![main form name]![subform control name].Forms![control name]


If IsNull(Forms![TWC_Edit_and_Print_FM]![TWC_No_Lookup_FM].Forms![TWC_ID]) Then

stDocName = "Create_TWC_MCR"
DoCmd.RunMacro stDocName

Else


Call TWCExistMessage


End If

Exit_Create_New_TWC_BT_Click:

Exit Sub

Err_Create_New_TWC_BT_Click:
    MsgBox Err.Description

DoCmd.SetWarnings True

Resume Exit_Create_New_TWC_BT_Click

End Sub

Thanks

MARK
 
Replace this:
.Forms!
with this:
.Form!

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top