G
Guest
I have a form with a sequence of the same blank fields, which the user fills
from another form control. The idea is that they select what they consider is
the correct address, and the control sends the data to the next available
empty field on the Target Form.
All works well; except for when the user selects the incorrect entry, the
action still takes place, and the incorect entry is placed in the empty
field, and due to the nature of the action, the sequence moves to the next
available empty field.
I need a way of dealing with the incorrect entry. What I want to happen is
nothing. Just leave the available field empty, and… available for the next
attempt at getting it right. I suppose what I am asking is the possibility of
having an ‘If’ multiple condition, but I can’t seem to code for that scenario.
Which would be somehting like:
If the target field is blank
AND the target field is the correct match
Then fill it it.
If not, just leave it available for antother try.
This is the code on my ‘Field Selector Control’, which works so far as
described above.
Private Sub Waypoint_Selector_Click()
If IsNull(Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo]) Then
Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo] = Me.Waypoint_Selector
Else
Parent.frm_Run_Test.SetFocus
Parent.frm_Run_Test.Form.Waypoint_Combo.SetFocus
RunCommand acCmdRecordsGoToNext
If IsNull(Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo]) Then
Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo] = Me.Waypoint_Selector
Else
MsgBox "All fields are filled"
End If
End If
End Sub
This is my Code for the ‘Target Control’ based on a After Update property:
Private Sub Waypoint_Combo_AfterUpdate()
With CodeContextObject
If (Waypoint_Combo = Run_waypoint) Then
AnswerBox_Waypoint = -1
End If
If (Waypoint_Combo <> Run_waypoint) Then
AnswerBox_Waypoint = 0
Waypoint_Combo = Null
End If
End With
DoCmd.GoToRecord , , acNext
End Sub
I tried the line ‘Waypoint_Combo = Null’ in the above code, but it didn’t work
Can someone help me understand where I’m going wrong?
from another form control. The idea is that they select what they consider is
the correct address, and the control sends the data to the next available
empty field on the Target Form.
All works well; except for when the user selects the incorrect entry, the
action still takes place, and the incorect entry is placed in the empty
field, and due to the nature of the action, the sequence moves to the next
available empty field.
I need a way of dealing with the incorrect entry. What I want to happen is
nothing. Just leave the available field empty, and… available for the next
attempt at getting it right. I suppose what I am asking is the possibility of
having an ‘If’ multiple condition, but I can’t seem to code for that scenario.
Which would be somehting like:
If the target field is blank
AND the target field is the correct match
Then fill it it.
If not, just leave it available for antother try.
This is the code on my ‘Field Selector Control’, which works so far as
described above.
Private Sub Waypoint_Selector_Click()
If IsNull(Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo]) Then
Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo] = Me.Waypoint_Selector
Else
Parent.frm_Run_Test.SetFocus
Parent.frm_Run_Test.Form.Waypoint_Combo.SetFocus
RunCommand acCmdRecordsGoToNext
If IsNull(Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo]) Then
Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo] = Me.Waypoint_Selector
Else
MsgBox "All fields are filled"
End If
End If
End Sub
This is my Code for the ‘Target Control’ based on a After Update property:
Private Sub Waypoint_Combo_AfterUpdate()
With CodeContextObject
If (Waypoint_Combo = Run_waypoint) Then
AnswerBox_Waypoint = -1
End If
If (Waypoint_Combo <> Run_waypoint) Then
AnswerBox_Waypoint = 0
Waypoint_Combo = Null
End If
End With
DoCmd.GoToRecord , , acNext
End Sub
I tried the line ‘Waypoint_Combo = Null’ in the above code, but it didn’t work
Can someone help me understand where I’m going wrong?