A good practice for editing data is to display the contents of the
particular record in an unbound form - the form is not connected to the
datasource/data table/query. You populate texttbox/checkbox controls
with the data from the record. You then perform your edits on that
record in the form and then submit the edits back to the table using sql
or DAO code.
Example using sql:
Private Sub cmdSubmitChanges_Click()
dim strSql As String
strsql = Update yourTable(fld1, fld2, fld3, ...) Set fld1 = '" & txtfld1
& "', fld2 = '" & txtfld2 & "', fld3 = " & chk1 & ", fld4 = #" & txtDate
& "#, ...
Where ID = " & txtID
Docmd.SetWarnings False
DoCmd.RunSql strSql
Docmd.SetWarnings True
End Sub
Note that you must delimit text values with single quotes 'textvalue',
date values with # pound symbol -- #4/1/2004#, and numbers/checkboxes
don't require delimiters. Don't forget the Where clause -- otherwise
you will end up updating your entire table to these values.
Rich
*** Sent via Developersdex http://www.developersdex.com ***