Update with SQL

F

Flightdisc

Hello,

I want to insert a value into a table field when I change a date in a text
field.

For example, I have a text box named txtEndDate that holds dates like
3/21/08, 1/27/09. When I change one of the dates to a different date, I want
to be able to insert a value into field DateChanged in table Employees.
After the old date has been changed, I want my hidden text box named
txtDateChanged whose Control Source is DateChanged to automatically update to
show the inserted value.

Can this be done using SQL?

FD
 
A

Allen Browne

You can execute an Update query in the AfterUpdate event of txtEndDate, but
that probably would not be the best approach.

If DateChanged is in the same table, you don't need an update query, and it
would only give you a concurrency problem.

If the current form is not bound to the Employees table, having DateChanged
there is not normalized. It would be better to have it in the same table
this form is bound to. That way, you solve a stack of problems, such as:

a) What is the most recent date changed if you delete the record that had
the most recent date changed?

b) How do you undo it if the user undoes their edit after you already
executed your Update query (since you've now lost the original value.)
 
B

Bob Quintal

Hello,

I want to insert a value into a table field when I change a date
in a text field.

For example, I have a text box named txtEndDate that holds dates
like 3/21/08, 1/27/09. When I change one of the dates to a
different date, I want to be able to insert a value into field
DateChanged in table Employees. After the old date has been
changed, I want my hidden text box named txtDateChanged whose
Control Source is DateChanged to automatically update to show the
inserted value.

Can this be done using SQL?

FD

Are you saying that you have two different dates in the same textbox?
If so that's a bad design and will give all sorts of problems trying
to determine what's actually been changed when.

If your txtDateChanged is hidden, automatically updating it won't
show a change, it'll still be hidden.
 
F

Flightdisc

Hmmm, you both have valid points. I need to evaluate what I've done thus far
with your points of view added in. Let me get back to you on this one gents.
Thank you both for your insight and ability to see what I failed to
consider. Whew, I think I just dodged a cannon ball.

FD
 

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