View Single Post
Old 09-12-2019, 09:52 AM   #12
Lkwdmntr
Newly Registered User
 
Join Date: Jul 2019
Posts: 105
Thanks: 2
Thanked 0 Times in 0 Posts
Lkwdmntr is on a distinguished road
Re: DLookup not working

Thanks for all the input. I went back to the DLookup and just changed the <> to >=. Works well now. Thanks again.
Dim Id As Integer, wkNum1 As Integer, wkNum2 As Integer, Status As String, lookupwk1 As Integer, lookupwk2 As Integer

Id = Form_FRM_Select_Users.SelectUserID.Value
wkNum1 = 1
wkNum2 = 2
If DLookup("[WeekNumber]", "Standard_Actions", "[UserID]=" & Id & " And [WeekNumber] =" & wkNum1) <> 1 Then
DoCmd.OpenForm "FRM_Meal_Categories", acNormal, , , acFormAdd
Form_FRM_Meal_Categories.UserID.Value = Id
Form_FRM_Meal_Categories.WeekNumber.Value = wkNum1
Form_FRM_Meal_Categories.FullName.Value = DLookup("[FullName]", "Users", "[UserID]=" & Id)
Form_FRM_Meal_Categories.Before_Breakfast_Snack.Se tFocus
DoCmd.Close acForm, "FRM_Select_Users"
Else
If DLookup("[WeekNumber]", "Standard_Actions", "[UserID]=" & Id & " And [WeekNumber] =" & wkNum2) >= 2 Then
MsgBox "You have already created a plan for this user. If you would like to edit week one, select 'Edit Existing User' in the Main Menu.", vbOKOnly
DoCmd.OpenForm "MainMenu", acNormal
DoCmd.Close acForm, "FRM_Select_Users"
Else
DoCmd.OpenForm "FRM_Edit_Standard_Actions", , , "UserID =" & Id & " And " & "WeekNumber =" & wkNum1, acFormEdit
Form_FRM_Edit_Standard_Actions.RiseTime.SetFocus
DoCmd.Close acForm, "FRM_Select_Users"
End If
End If
Lkwdmntr is offline   Reply With Quote