kbsudhir
07-21-2009, 11:24 AM
Hi All,
I am calling a query from the access form under a button click.
Below is the code which I am using:
UserName = VBA.Environ("UserName")
CurrDate = Format(Now(), "Short Date")
CurrTime = Format(Now(), "Long Time")
rs.Open "SELECT TimeCapture.UserID, TimeCapture.BreakStartTime, TimeCapture.BreakEndTime, TimeCapture.Date From TimeCapture WHERE TimeCapture.Date =#" & CurrDate & "# AND TimeCapture.BreakStartTime <= #" & CurrTime & "# AND TimeCapture.BreakEndTime Is Null AND TimeCapture.UserID= " & UserName & "", cn, adOpenStatic, adLockOptimistic
I am getting an error "No Value given for one or more required parameters"
But when I ma checking all the the variables "UserName", "CurrTime" & "CurrDate" are having values.
Please guide where I am going wrong.
Regards
Sudhir
I am calling a query from the access form under a button click.
Below is the code which I am using:
UserName = VBA.Environ("UserName")
CurrDate = Format(Now(), "Short Date")
CurrTime = Format(Now(), "Long Time")
rs.Open "SELECT TimeCapture.UserID, TimeCapture.BreakStartTime, TimeCapture.BreakEndTime, TimeCapture.Date From TimeCapture WHERE TimeCapture.Date =#" & CurrDate & "# AND TimeCapture.BreakStartTime <= #" & CurrTime & "# AND TimeCapture.BreakEndTime Is Null AND TimeCapture.UserID= " & UserName & "", cn, adOpenStatic, adLockOptimistic
I am getting an error "No Value given for one or more required parameters"
But when I ma checking all the the variables "UserName", "CurrTime" & "CurrDate" are having values.
Please guide where I am going wrong.
Regards
Sudhir