Hi,
I have a long if then statement, its so long that in the if/then portion, I need to move to the next line. However I do not know what is used to do so.
Here's the example of my code - but how do I place it on multiple lines without getting an error?
The portion in Bold is one long line, because when I do a carriage return - VBA is looking for 'Then' in my if/then statement, preventing me from going that route.
I have a long if then statement, its so long that in the if/then portion, I need to move to the next line. However I do not know what is used to do so.
Here's the example of my code - but how do I place it on multiple lines without getting an error?
Code:
Private Sub btnAddNew_Click()
'add new record
[B] If (IsNull(Me.text1.Value)) Or (IsNull(Me.text3.Value)) Or (IsNull(Me.text02.Value)) Or (IsNull(Me.text4.Value)) Or (IsNull(Me.text5.Value)) Or (IsNull(Me.text6.Value)) Or (IsNull(Me.text7.Value)) Or (IsNull(Me.text8.Value)) Or (IsNull(Me.text9.Value)) Or (IsNull(Me.text10.Value)) Or (IsNull(Me.text11.Value)) Or (IsNull(Me.text12.Value)) Or (IsNull(Me.text013.Value)) Or (IsNull(Me.text14.Value)) Or (IsNull(Me.text15.Value)) Or (IsNull(Me.text16.Value)) Then[/B]
' MsgBox "All Fields are required before moving on."
' Me.Combo1.SetFocus
' Else '
Set rstLabData = CurrentDb.OpenRecordset("LaboratoryData_Table", dbOpenTable)
rstLabData.Edit
AddNewLabData
rstLabData.Update
ClearForm
'End If
End Sub
Comment