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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Statement within If statement 1

Status
Not open for further replies.

jmbcreative

Technical User
Jan 30, 2006
58
US
I have an event that has an if statement. Within the "then" statement of that "if" statement I need a second "If" statement to return a value. How do I do this?

I keep getting a compile error on the second if Statement.

Here is what my code looks like now:

**************************************
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Me.System.Value = Form_ChangeLogEntry.System.Value
Me.Location.Value = Me.Combo26.Column(2)
DoEvents
If Form_ChangeLogEntry.Type.Value = "Add System" Then

Dim strMax1
strMax1= If(DMax("[ControlID]","HardwareList") > DMax("[ControlID]","HardwareAdd"), 1+ DMax("[ControlID]","HardwareList"), 1+ DMax("[ControlID]","HardwareAdd"))
Me.ControlID = CStr(Val(strMax1))

****************************************

 
Have a look at the IIf function and remember to use End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top