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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

time stamp the text box on the form & transfer records to other table

Status
Not open for further replies.

hu5

Technical User
Apr 9, 2004
28
US
I created a form based on a table, one text box is to enter text string. I wish to add date/time stamp to the text box when user refresh records, can it be set up automatically?

another problem:
If user type " .... completed." in the text box and refresh record, that data get loaded into the record in the table, will it be possible for that completed record to transfer to an archived table? Thanks for your help.
 
Hi!

#1
Adding a timestamp to a control:

[tt]Me!txtControl.Value = Now[/tt]

Should it alredy contain something, you could try concatination:

[tt]Me!txtControl.Value = Me!txtControl.Value & " Tmstmp: " & Now[/tt]

Event - hmmm - if it's every time a change is saved, use the before update event of the form (fires whenever a save is performed)

#2
Perhaps the before update/after update event of the form, run some sql:

[tt]dim sSql as string
sSql = "INSERT INTO table2 ( fldDate, fldNum, fldText ) " & _
"VALUES (#" & Forms![MyForm]!txtDate & "#," & Forms![MyForm]!txtNum & _
",'" & Forms![MyForm]!txtText & "');"
docmd.runsql ssql[/tt]

Is the code supposed to test for the text "completed" within the textbox?

[tt]if instr(me!txtBox.Value,"completed")=0 then
' perform the above...[/tt]

- this sample contains both date, numeric, and text fields, note the delimiters, hash (#) for dates, single quote (') for text, nothing for numerics.

- but saving the same data in two tables, isn't encouraged (violates lots of database rules;-)), it's bound to give future headaches...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top