So all input to the form is from queries not tables. one field in the query is the time the form is displayed. I have a text field on the form that displays the "time()" just fine but I need to get that time written back to one of the tables via the query.
A query is built on tables, so even if the immediate input is from queries, the data is stored in tables. If the control (forms have controls, not fields) that displays Time is bound to the correct field in the query, the table to which this field belongs will be updated, if the query is updateable: not all queries are, hence my question.
The database engine for Microsoft Access is Jet and it understands SQL (Structured Query Language), which is why Tek-Tips has a forum:
Microsoft: Access Queries and JET SQL Forum: forum701
Where you will find many examples.
You can run SQL through VBA code, which is what I suggested above:
[tt]strSQL="Update tblTable Set TimeField=#" & Me.TimeField _
& "# Where ID=" & Me.ID[/tt]
CurrentDB.Execute strSQL
You should substitute the italicized names with the correct names for your database, if you intend to use this method.
[tt]CurrentDB.Execute strSQL[/tt] will run the SQL immediately, without warnings. [tt]DoCmd.RunSQL strSQL[/tt] will run the SQL with warnings.
It is usually better to store Date / Time rather that just Time, therefore I suggested Now() in my example, which returns both.
I hope this is clearer.