date field not populating

G

Guest

I have a form with a part, spare or not (check box) and a
date field. If the user checks the box, I want to capture
the date and the user id.

For the on click event of the check box, I set date field
to date(). Yet, it does not capture the date. Also, how
do I capture the network id of the person entering the
data?

Thank you
 
G

Guest

I am using the code. But, when i try to use the function
as a control source, it errors out "Name#". For the date
field, in the "On Click" event of the check box, I have

Click_date = date()
 
J

joemach

Hi,

A check box will not store a date. It will store True/False or Yes/No type
data.

You will get this 'Name#' error when something doesn't make sense to Access.

The control source for the text box should be the name of the field stored
in the database. Then in the On Click event of the check box you could
write code like:

txtDate=Date()

Also you should not name you fields of controls with words that are used by
Access.


HTH

joemach
 
W

Wayne Morgan

Is this field you are trying to place the date into bound to a textbox? Do
the textbox and the field have the same name? Is so, try changing the name
of the textbox so that you don't have two objects with the same name. If the
field is called Click_date, then try txtClick_Date for the name of the
textbox.

Also, VBA will usually remove the () from the end of Date, it will get left
on in queries and in the Properties sheet of controls. Did you place this
code in the Click event of the checkbox or in the Properties sheet of the
textbox where it says On Click? If the latter, change the On Click line to
[Event Procedure], click the ... button, and enter the code in the VBA
editor in the Click event of the checkbox. The click event will look
something like:

Private Sub NameOfCheckbox_Click()

End Sub

Place your code between the two lines above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top