Date shown in textbox.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form that allows me to enter data for the relevant fields of
a table. The data will be treated as 1 record and be added to the table upon
pressing the OK command bar.

1 of the field is "updated" which records the date of the last amendment to
the record.

What I would like to enquire is that, is there any ways to make the current
date to appear in the "updated" textbox??

Any help is greatly appreciated.
 
To pass a value to a field in the form, use this

Me.[FieldName] = Date()
If the field on a seperate form, then
Forms![Main form name].[FieldName] = Date()

If the field in a sub form
Forms![Main form name]![Sub form control name].form![FieldName] = Date()
 
Hi Ofer,

I tried this method, but it doesn't work. Here's my syntax:

Me.text23 = Date()


text23 is the name of the textbox. But nothing was shown. I put the code in
the beforeUpdate event.

Ofer said:
To pass a value to a field in the form, use this

Me.[FieldName] = Date()
If the field on a seperate form, then
Forms![Main form name].[FieldName] = Date()

If the field in a sub form
Forms![Main form name]![Sub form control name].form![FieldName] = Date()

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Swish said:
I have created a form that allows me to enter data for the relevant fields of
a table. The data will be treated as 1 record and be added to the table upon
pressing the OK command bar.

1 of the field is "updated" which records the date of the last amendment to
the record.

What I would like to enquire is that, is there any ways to make the current
date to appear in the "updated" textbox??

Any help is greatly appreciated.
 
If the field text23 is bound to the field in the table then the date will be
entered to the table every time you update the record.
The before update event works as you move to another record, or close the
form, or save the record, and this is why you cant see the date changes, but
it will change the value in the table


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Swish said:
Hi Ofer,

I tried this method, but it doesn't work. Here's my syntax:

Me.text23 = Date()


text23 is the name of the textbox. But nothing was shown. I put the code in
the beforeUpdate event.

Ofer said:
To pass a value to a field in the form, use this

Me.[FieldName] = Date()
If the field on a seperate form, then
Forms![Main form name].[FieldName] = Date()

If the field in a sub form
Forms![Main form name]![Sub form control name].form![FieldName] = Date()

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Swish said:
I have created a form that allows me to enter data for the relevant fields of
a table. The data will be treated as 1 record and be added to the table upon
pressing the OK command bar.

1 of the field is "updated" which records the date of the last amendment to
the record.

What I would like to enquire is that, is there any ways to make the current
date to appear in the "updated" textbox??

Any help is greatly appreciated.
 
Back
Top