Update fields !

  • Thread starter Thread starter peter junker
  • Start date Start date
P

peter junker

Hello - if id like to update fields in a table, without using a form, is
this possible
automaticly after i left a field.
for example - i put in the coustomer ID - after i did update the field, id
like to update based on the coustomer ID - all the dates directly in this
table ( the fields ) , not in the form!

thanks peter
 
Hi,
Pretty much anything is possible, you just have to code it.
In this case you would use a SQL Update statement and execute it in code.
The values for the fields you are updating are taken from the controls on the form.

I'll give you the general idea. In this sample, there are two controls on the form that have dates in them.

Dim strSql as String

strSql = "Update yourTable Set dateField1 = #" & Me.control1 & _
"#, dateField2 = #" & Me.control2 & "#"
CurrentDb.Execute strSql, dbFailOnError

Dates must be delimited with #
Strings with quotes '
Numbers need no delimiters

For dates, if your format is not mm/dd/yyyy you might want to use the Format function
to put them in this format, otherwise Jet gets confused as to which part is the month and which is the day.

You can also run into trouble with strings if they have embeded quotes within ("Dan's Bar & Grill")
but that's a whole other topic.
 
Hi,
Sorry, I think I misunderstood what you wanted.
You cannot do this by entering data directly into tables, you have
to use forms.
 
Back
Top