Good Morning All;
I have a field on a bound form called ‘date’; that has a date picker associated to it; this populates an unbound textbox once the date has been selected.
What I need to do is; once the date has populated the unbound textbox; is to populate a bound textbox field on my form (date1), but if this field contains data then move to the second bound textbox field (date2) and move to (date3) if ‘date2’ contains data.
I the following code on a combobox that updates textboxes when selected, but I cannot get the same code to work for the scenario above:
Private Sub checktype_AfterUpdate()
Dim intCheckName As Integer
intCheckName = 1
If Nz(Me.check_name1, 0) = 0 Then 'apply selected name to check_Name1
intCheckName = 1
ElseIf Nz(Me.check_name2, 0) = 0 Then 'apply selected name to check_Name2
intCheckName = 2
ElseIf Nz(Me.check_name3, 0) = 0 Then 'apply selected name to check_Name3
intCheckName = 3
Else 'all 3 check_Names contain a value
MsgBox "All check names selected", vbInformation
Exit Sub
End If
Select Case intCheckName 'check preceding check_Name fields do not equal current name
Case 1
Me.check_name1 = Me.checktype
Case 2
If Me.checktype = Me.check_name1 Then 'matches Me.check_Name1
MsgBox "The name " & Me.checktype & " has already been submitted", vbInformation
Exit Sub
End If
Me.check_name2 = Me.checktype
Case 3
If Me.checktype = Me.check_name1 Or Me.checktype = Me.check_name2 Then
MsgBox "The name " & Me.checktype & " has already been submitted", vbInformation
Exit Sub
End If
Me.check_name3 = Me.checktype
End Select
End Sub
If anyone could help with this, it would greatly be appreciated.
Kind Regards
Tor Fey
I have a field on a bound form called ‘date’; that has a date picker associated to it; this populates an unbound textbox once the date has been selected.
What I need to do is; once the date has populated the unbound textbox; is to populate a bound textbox field on my form (date1), but if this field contains data then move to the second bound textbox field (date2) and move to (date3) if ‘date2’ contains data.
I the following code on a combobox that updates textboxes when selected, but I cannot get the same code to work for the scenario above:
Private Sub checktype_AfterUpdate()
Dim intCheckName As Integer
intCheckName = 1
If Nz(Me.check_name1, 0) = 0 Then 'apply selected name to check_Name1
intCheckName = 1
ElseIf Nz(Me.check_name2, 0) = 0 Then 'apply selected name to check_Name2
intCheckName = 2
ElseIf Nz(Me.check_name3, 0) = 0 Then 'apply selected name to check_Name3
intCheckName = 3
Else 'all 3 check_Names contain a value
MsgBox "All check names selected", vbInformation
Exit Sub
End If
Select Case intCheckName 'check preceding check_Name fields do not equal current name
Case 1
Me.check_name1 = Me.checktype
Case 2
If Me.checktype = Me.check_name1 Then 'matches Me.check_Name1
MsgBox "The name " & Me.checktype & " has already been submitted", vbInformation
Exit Sub
End If
Me.check_name2 = Me.checktype
Case 3
If Me.checktype = Me.check_name1 Or Me.checktype = Me.check_name2 Then
MsgBox "The name " & Me.checktype & " has already been submitted", vbInformation
Exit Sub
End If
Me.check_name3 = Me.checktype
End Select
End Sub
If anyone could help with this, it would greatly be appreciated.
Kind Regards
Tor Fey