C
Charles
I have a piece of code that runs an append parameter query. When I run it as:
Set db = CurrentDb
Set qdf = db.QueryDefs("Pre-2008 Step4 app_Transactions")
qdf.Parameters(0) = #12/31/95#
qdf.Execute dbFailOnError
it works.
But if I try to make the date a string variable that I concatenate it
doesn't work. For example:
Set db = CurrentDb
Set qdf = db.QueryDefs("Pre-2008 Step4 app_Transactions")
ValYear = Left(Right(strMyArray(intI), 6), 4)
ValMonth = Right(strMyArray(intI), 2)
Select Case ValMonth
Case "01", "03", "05", "07", "08", "10", "12"
ValDays = "31"
Case "04", "06", "09", "11"
ValDays = "30"
Case "02"
ValDays = "28"
Case Else
GoTo Error_Handler:
End Select
If ValDays = "28" And ValYear = "2008" Then ValDays = "29"
ValDate = "#" & ValMonth & "/" & ValDays & "/" & ValYear & "#"
qdf.Parameters(0) = ValDate
qdf.Execute dbFailOnError
It errors out. It there someway I can make this work with the date as a
variable I can create from a string?
Thanks
Set db = CurrentDb
Set qdf = db.QueryDefs("Pre-2008 Step4 app_Transactions")
qdf.Parameters(0) = #12/31/95#
qdf.Execute dbFailOnError
it works.
But if I try to make the date a string variable that I concatenate it
doesn't work. For example:
Set db = CurrentDb
Set qdf = db.QueryDefs("Pre-2008 Step4 app_Transactions")
ValYear = Left(Right(strMyArray(intI), 6), 4)
ValMonth = Right(strMyArray(intI), 2)
Select Case ValMonth
Case "01", "03", "05", "07", "08", "10", "12"
ValDays = "31"
Case "04", "06", "09", "11"
ValDays = "30"
Case "02"
ValDays = "28"
Case Else
GoTo Error_Handler:
End Select
If ValDays = "28" And ValYear = "2008" Then ValDays = "29"
ValDate = "#" & ValMonth & "/" & ValDays & "/" & ValYear & "#"
qdf.Parameters(0) = ValDate
qdf.Execute dbFailOnError
It errors out. It there someway I can make this work with the date as a
variable I can create from a string?
Thanks