Update Query: Parameters = Date & Text Field on Form

R

ryan.paquette

From a form, I have an update query to update a date field in a
table.
(the form is not based on this table)

Zero records are being updated.
I assume I refered to the controls properly as it is not asking for
any parameters...
The Code on the form is was created by the design wizard.
The SQL in the Query is as follows:

UPDATE tblNext_and_Dates SET tblNext_and_Dates.[Next] = [Forms]!
[frmTraining_Selection]![cboSchDate]
WHERE ((([tblNext_and_Dates].[Training Name])=[Forms]!
[frmTraining_Selection]!Training_Name));


I checked the records on the table to verify the criteria & that's
OK...
I checked the format of the Date field on both the table & the form.
They are both Med.Date.
Any Ideas?

FYI: I'm using Access 2000 SP2.
 
J

Jeanette Cunningham

hi ryan,
try this code:
Private Sub UpdateTheDate()
Dim db As DAO.Database
Dim strSQL As String

Set db = DBEngine(0)(0)

strSQL = "UPDATE tblNext_and_Dates " _
& "SET tblNext_and_Dates.Next = #" & Format(Me.cboSchDate,
"mm\/dd\/yyyy") & "# " _
& "WHERE tblNext_and_Dates.[Training Name]= """ & Me![Training_Name]
& """"
Debug.Print strSQL
db.Execute strSQL
Set db = Nothing

End Sub

Jeanette Cunningham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top