i'm a bit confused with If's and end if, I am quite new to access and VBA so perhaps im missing the bleeding obvious
I have discovered (i think) that If a condition is met and I only want to do one thing , i only need If/then
but if I want to do more than one thing when a condition is met I need an 'end if'
basically I want to set three fields in a form when a button is pressed
but i only want to set them if the value of one of those fields is Null.
Ive tried a few things syntax wise but keep getting "block" errors ???
here is what I have
please point me in the right direction
I have discovered (i think) that If a condition is met and I only want to do one thing , i only need If/then
but if I want to do more than one thing when a condition is met I need an 'end if'
basically I want to set three fields in a form when a button is pressed
but i only want to set them if the value of one of those fields is Null.
Ive tried a few things syntax wise but keep getting "block" errors ???
here is what I have
Code:
Private Sub GetNumbers_Click()
If Me![thisNumber] = Null Then
[INDENT]Me![thisNumber] = Nz(DMax("[TNumber]", "[Main]"), 0) + 1
Me![concatentaedRef] = Me![thisNumber] & Me![Suffix]
Me![OtherNumber] = Nz(DMax("[TOtherNumber]", "[Main]", "[TDateEntered] = #" & Forms!Main!DateEntered & "# "), 0) + 1[/INDENT]
End If
End Sub
please point me in the right direction