If not End If query

Tiggerjr82

New member
Local time
Today, 20:52
Joined
May 27, 2008
Messages
2
Hi
I have a field that when it is filled in I want a message to appear asking if the same code in that field should be added to the next new record created. I have added the following code to the button that creates the new record but i get an if, End if mismatch, can anyone see whats wrong with this please?

Dim DQ As String
Dim ctl As Control
Dim strMbox

DQ = """"

If Not IsNull(Text409) Then
strMbox = MsgBox("Same release for new record?", 4, "Check")
If strMbox = 6 Then
For Each ctl In Me.Controls
If ctl.Tag = "?" Then
ctl.DefaultValue = DQ & ctl.Value & DQ
End If
End If
End If

Next
 
You had "Next" on the wrong spot. If you use tabs in your code, these errors are much easier to identify.
Code:
Dim DQ As String
Dim ctl As Control
Dim strMbox

DQ = """"

If Not IsNull(Text409) Then
     strMbox = MsgBox("Same release for new record?", 4, "Check")
     If strMbox = 6 Then
         For Each ctl In Me.Controls
               If ctl.Tag = "?" Then
                    ctl.DefaultValue = DQ & ctl.Value & DQ
               End If
         Next
    End If
End If
 
Thanks - it works now :-)
 

Users who are viewing this thread

Back
Top Bottom