Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using SQL to update a field 2

Status
Not open for further replies.

abacus9

Programmer
Jan 14, 2000
4
US
I am trying to update a field based on an input from the user. I get the date but the update sql will not accept the 'strdate' as a value. The basic process is to check to see if the date entered is a valid date and if so update the Activity_Date field withe that date. Is there someting else I need to do? <br>
<br>
Function CheckDate()<br>
Dim strdate As Date<br>
strdate = InputBox(&quot;Enter date as 1/1/99 for this Report&quot;)<br>
' Test variable.<br>
<br>
If IsDate(strdate) Then<br>
' If string is date, format and display in dialog.<br>
<br>
DoCmd.RunSQL &quot;UPDATE Last_Update SET Activity_Date = 'strDate';&quot;<br>
<br>
Else<br>
MsgBox &quot;The value you entered is not a valid date.&quot;<br>
End If<br>
End Function<br>
<br>
Thanks<br>

 
abacus,<br>
Assuming that activity_date is a datetime attribute, use:<br>
DoCmd.RunSQL &quot;UPDATE Last_Update SET Activity_Date = #&quot; & strDate & &quot;#&quot;<br>
<br>
--Jim Horton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top