Hello Everyone
I am trying to validate a text box.
If the value entered in the text box is in a table, it should pop up with yes/no msg box.
1. If yes, then the current form should close or not visible and opens another form.
2. If no, then set focus on the text box.
If the value is not present in the table , current form closes, opens another form.
I am not able to get the second part.
I used the below code. Message box works fine.
Code:
Dim LResponse As Integer
If WeekendingCmbo = DLookup("[WeekEnding]", "Timesheet_T", "WeekEnding = #" & Format(Nz(Forms!Create_New_Entry_Menu_F!WeekendingCmbo, 0), "Short Date") & "# And EmployeeID= Text34 ") Then
LResponse = MsgBox("You have entered a timesheet on this week. Do you want to edit the existing timesheet. ", vbYesNo, "CONTINUE")
If LResponse = vbYes Then
Forms("Create_New_Entry_Menu_F").Visible = False
DoCmd.OpenForm "Edit_Timesheet_Menu_F"
Else
Me.WeekendingCmbo.SetFocus
End If
End If
But if the value is not present in the table. I am not able to process the steps for that.
Code:
Forms("Create_New_Entry_Menu_F").Visible = False
DoCmd.OpenForm "Create_New_Entry_F"