G
G deady via AccessMonster.com
I am trying to create a date variable in a case statement. I want to use
DLookup to pull a date from a date from another and pass it to a unbound
textbox to be used in a date calculation. I have to use a variable because
a textbox will only accept text. I keep getting a Type 13 mismatch error on
dlookup line when I fire the code. Here is my code::
------------
Private Sub Combo62_AfterUpdate()
Select Case Me.Combo62
Dim strFrm As String
Dim dob As Date
Case "Auto Accidents"
strFrm = "frm_AutoAccidents"
If MsgBox("Please review this form to make sure all data is correct. Are
you certain you wish to save this record?", vbQuestion + vbYesNo) = vbNo
Then
DoCmd.CancelEvent
Else
'save pending edits
DoCmd.RunCommand acCmdSaveRecord
strParameters = Me.SCVClientID & ";"
strParameters = strParameters & Me.SCVFileNo & ";"
strParameters = strParameters & Me.txt36 & ";"
strParameters = strParameters & Me.txt38 & ";"
strParameters = strParameters & Me.txt40 & ";"
strParameters = strParameters & Me.txt42 & ";"
dob = DLookup("Birthdate", "tbl_clientinfo", "ClientID = " & Me.SCVClientID)
& _
"#"
Can someone tell me what the correct dlookup statement should be?
DLookup to pull a date from a date from another and pass it to a unbound
textbox to be used in a date calculation. I have to use a variable because
a textbox will only accept text. I keep getting a Type 13 mismatch error on
dlookup line when I fire the code. Here is my code::
------------
Private Sub Combo62_AfterUpdate()
Select Case Me.Combo62
Dim strFrm As String
Dim dob As Date
Case "Auto Accidents"
strFrm = "frm_AutoAccidents"
If MsgBox("Please review this form to make sure all data is correct. Are
you certain you wish to save this record?", vbQuestion + vbYesNo) = vbNo
Then
DoCmd.CancelEvent
Else
'save pending edits
DoCmd.RunCommand acCmdSaveRecord
strParameters = Me.SCVClientID & ";"
strParameters = strParameters & Me.SCVFileNo & ";"
strParameters = strParameters & Me.txt36 & ";"
strParameters = strParameters & Me.txt38 & ";"
strParameters = strParameters & Me.txt40 & ";"
strParameters = strParameters & Me.txt42 & ";"
dob = DLookup("Birthdate", "tbl_clientinfo", "ClientID = " & Me.SCVClientID)
& _
"#"
Can someone tell me what the correct dlookup statement should be?