Results 1 to 3 of 3
  1. #1
    viper is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    26

    Button to fill txt box with "Now ()"

    I have a DB where I am issued badges to visitors with ID numbers, in my Event Table (This is where I'm capturing the In & Out data) I have my Out txt box with a default value of "Now ()" so that once a new record is created it uses the system clock to time stamp the out field the Date and Time it was issued. What I want to do is have a button to use the "Now ()" function and enter that text into the In field to time stamp when the badge was returned. I cannot set the In field with the default value of "Now ()" because when a new record is created it will put a time stamp in the In field, I need it to be blank until the badge is returned.



    What I've tried is creating a macro; I use the SetValue function with the following parameters.

    Item: [Forms]![EventTable]![TimeIn].[OnClick]
    Expression: [Forms]![EventTable]![TimeIn]=[Now ()]

    But I keep getting an error stating

    "Visual Basic can’t' convert the data type of one of the arguments you entered. You tried to run a Visual Basic procedures that executes a method or sets a property of an object. Check the component's documentation for information on the properties and methods it makes available for Automation operations."

    Any ideas?

    Thanks

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Add a button to the form and then add an event procedure on the OnClick event. In Vb put something like this:

    Me!TextboxName = Now()

  3. #3
    viper is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    26
    Works perfict!! thanks...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-10-2010, 02:12 PM
  2. Replies: 3
    Last Post: 02-23-2010, 06:32 PM
  3. "Next" Command button.
    By vCallNSPF in forum Forms
    Replies: 8
    Last Post: 01-20-2010, 04:26 PM
  4. Create "reset filter" button
    By vanlanjl in forum Access
    Replies: 0
    Last Post: 03-03-2009, 07:36 AM
  5. "Previous Month" button
    By allochthonous in forum Programming
    Replies: 3
    Last Post: 09-10-2006, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums