Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2008

    Unanswered: Command button for time & date

    I hope I can explain this right...I am looking to add START DATE, COMPLETION DATE, START TIME, & FINISH TIME buttons to an existing form, so that when you press the START DATE button it
    would insert the current date into the field; when you press the START TIME -the current time is inserted and so on. I then put "Me.[START DATE] = Date" and "Me.[START TIME] = Time" in the Click event procedure of the buttons, and this message box popped up when I clicked on the buttons:

    "Microsoft Office Access can't find the macro "Me."

    The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved.

    Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's macro group was last saved under."

    After getting it to work for START DATE and START TIME, I haven't got it to work yet for FINISH TIME and END DATE; I've tried putting those names into the code, but it is not working. I then realized that there were text boxes underneath the command buttons I had created, and I thought that is what was causing the problem. Well, I was wrong again. I thought I had fixed it, and then when I had opened the form in design view, the following visual basic message came up: "Microsoft
    Visual Basic: Compile error--can't find project or library" and the following:

    Function fOSUserName() As String----------->highlighted
    ' Returns the network login name
    Dim lngLen As Long, lngX As Long
    Dim strUserName As String
    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If (lngX > 0) Then
    fOSUserName = Left$(strUserName, lngLen - 1)
    fOSUserName = vbNullString
    End If
    End Function

    Any suggestions? I've attached a copy of the database in a zip file for reference.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2007
    Adelaide, South Australia
    There's no forms to look at in that database, so can't really help much.

    The code above works fine on my system.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jun 2007
    Maitland NSW,Australia
    StarTrekker - The forms etc. are hidden

    I changed Me.[START DATE] to me!startdate have a look at the attached zip file for the changes to the other time and date fields.

    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts