A button to paste a time stamp in a field or two

SmartCarFun

Registered User.
Local time
Today, 19:54
Joined
Feb 17, 2012
Messages
25
Hi,

I want to place Now() timestamp in a field when an operator hits a button, I would also like to tick a box.

Can anyone help with ideas

Thanks in advance
 
Howzit

In the event procedure of your button place something like

Code:
me.yourcontrol = Now()
me.yourothercontrol = Now()
me.yourtickcontrol = true
 
Hi thanks,

My code;

Private Sub but2CA_Click()
Me.TS_2CashApps = Now()
End Sub

Complie Error: Methosd or data member not found

TS_2CashApps is a date field in my table

I probably took you too literally!

Thanks
 
Howzit

But is it the "Name" of the control on your form. See the Properties Sheet - Other Section?

That is what the me.TS_2CashApps will refer to
 
No my control is the button "but2CA"
The data I want to store = Now()
The place I want to store it "[MASTER].[TS_2CashApps]
The event On Click

Cheers
 
Howzit

Is the form bound to the table Master? DO you have controls on your form bound to the table fields TS_2CashApps etc? That is can you see the fields on your form where you want to update the values? Or is it an unbound form?
 
[Master] is the table
[Master_Collections] is a query of [Master]
[Collectors] is continuous form of which the data source is [Master_Collections] query
[TS_2CashApps] is a field in the query->Table, Its not one that is shown in the form but could be as it resides in [Master_Collections] query

I hope that is kinda clear!
 
Howzit

If you add the missing field to the form, take note of the name of the control when you add it as it will be that name that you use in the me.controlname = Now() part. You can make it invisible if you do not want to see it.

It is the absense of this control you are getting the eroor message mentioned earlier.
 
Hi,
I realise now I need to refresh the records to complete the task, the refresh will remove the record from the list, here is the code I've settled on;

Private Sub but2CA_Click()
Me.TS_2CashApps = Now()
Me.CollectorComplete = True
Me.Refresh
End Sub

can I add a line to refresh the records? I tried the above but its not refreshing! The record is still visible

Thanks
 
Thanks, it worked after some time, not sure why but good now,

My questions are quite basic I guess, where is a good place to learn more about VBA, the basics anyway?
 

Users who are viewing this thread

Back
Top Bottom