if it is sql or access, just put in as the default value
that will do it
if you have difficulties, please let me know
your welcome, if it worked please remember to click accept
So let me explain, I have a form which captures EMS vehicle dispatch data, the field I am trying to populate with the time is Call Details.Vehicle1 dispatch time, I am trying to get the time into that field on click from a button on the form, however, =now() doesnt work as it is formatted for time, not long date.
Also am unsure of the query builder syntax to tell it to populate the other field with the time, once clicked
what is it? MS SQL, ACCESS? .NET?
once i know I can give you the correct syntax
ok, go to the field in form design
right click and choose properties
ok look for default value
in it type
and click out of it and test
Ok, thanks, XXXXX XXXXX but remember, I need them to click a button to set the time, got pretty serious legal requirement as it is the recorded time for ambulance dispatch, there will be a lag between them starting capturing call data, and dispatching the ambulance, hence the requirement to trigger an event based on button click
ok, then on the button event do this
pretend the name of the field that holds the date it DATEFIELD
the onclick event of the button has this
me.DATEFIELD.value = now()
then when they click the button it would put it in the field
Awesome, checking, thanks
Do i need the table name or just the field name?
sorry not field
the name of the text box on your form that will hold the value
Ok, sorry for being dumb, been years since I did this. Text box control is Vehicle 1 dispatch time, get an error when I enter me.Vehicle 1 dispatch time.value = now()
Ah! do I need to rename the field in the table to kill out the spaces first?
no, just name the control without spaces
Ok, error now is it cant find macro called ME
did you do
me.control.value = now()
in the onclick event of the button?
can you copy and paste it all here, including the sub name
Exact text in the onclick event is: "me.Vehicle1dispatchtime.value = now()
when you type me.
do you see a list of controls?
Starting over, 1 sec
Ok, when I do it in the expression builder I see it breakdown the command correctly, but now has different error.
are you doing this in the onclick event of the button?
let me make an example for you and send it
Ok, thanks. I've done it both in the onclick box and also in the event builder, same result, I know Im being stupid, just cant remember how to!
look at form1
and youll see how I have done it
let me know if it still doesnt work for you please
Thanks will check now
I will do, Thanks for your help
Got compile error: Method or data member not found.
Am gonna take the spaces out of the field name and see if that works
ok... but should matter
just the control name is important
OK, still no luck, matches your's exactly, with control name set right, Compile error: Method or data member not found
can you upload the DB?
go to www.wikisend.com
give me the download link and I will do it for you
how did you go with this Bryan?
Uploaded database to link here: http://wikisend.com/download/408932/Emer-G-Med Project.accdb Table being populated is Call Details, Form in question is also Call details. You will see an unmarked button on top of the Time1 field (renamed to rule out a syntax error) if you could be so kind as to show me how you would populate the Time1 field on click I'd be very grateful
ok, found the problem, you had the wrong name
put this in the buttons onclick and replace the other code you did
Me.Vehicle_1_dispatch_time.Value = Now()
let me know how it goes please
Brilliant, thanks a lot!!