Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple-update table with date when criteria on form is changedd

Status
Not open for further replies.

kensaffer

Programmer
Jan 7, 2005
39
0
0
US
Frustrating but the solution is simple (I Think).
Running Access 2000 on Sql Server and using an ADP.
Have a drop down on form, call it type - with 5 types, and when the type changes I want to insert into the table the current date into the specific typedate field. The TypeDate is not on the form. Let's say the types are male,female,aunt,uncle and pet. So I would have a MaleDate, a FemaleDate,AuntDate, etc. When one changes form male to female then the FemaleDate would be populate with current date.
I tried a macro, didn't work, a stored procedure and it didnt work. perhaps the syntax is also hurting as well. CAnanyone help with this 'simple' solution ???
 
Ken, just to clear up one issue for you, if you have a recordset bound to a Control or Form it will be static. You need to requery the recordset to satisfy any new criteria. For example, on the Form the syntax is Me.Requery on a Control it is controlname.Requery. You could do this after running the stored procedure.
 
Paul, one quick last question. how can I put the code on two lines so it can be viewed easier ? Does it end with some character ?
 
Paul, Thanks for the additional tip, I'm not running a stored procedure but just the update statement in the code.
When I do need to do this would it be just me.requery ?
Is there any other commands to the code ? How about with the controlname.requery ? By the way is that the syntax controlname ?
Paul, after writing this I wonder if waht you are saying is if after the form or control is changed, I need to do a requery to view the changes ?
 
I assume you want to break up the sql

DoCmd.RunSQL "Update accountstbl" & _
" SET CharityCareDate = getdate ()" & _
"where accountstbl.account = '" & Caccount &"'"

This should do it.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top