Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    121

    Unanswered: fOSUserName Problem

    I imported a form and table from a friend who logs users into a table to see who is using the program. However when I try to run the form as the startup form, I get an error on the strTKNum = fOSUserName command line (it highlights the fOSUserName part of the line). I made no changes from his program and it works fine in his application on the same LAN. Any suggestions?

    Private Sub Form_Open(Cancel As Integer)
    On Error GoTo Err_Form_Open

    Dim dbs As Database, rstAssoc As Recordset
    Dim intcount As Integer
    Dim strTKNum As String

    strTKNum = fOSUserName
    Set dbs = CurrentDb
    Set rstAssoc = dbs.OpenRecordset("Associate Log", dbOpenTable)

    rstAssoc.AddNew
    rstAssoc!TKNumber = strTKNum
    rstAssoc!EmpName = fGetFullNameOfLoggedUser
    rstAssoc!DateIn = Date
    rstAssoc!TimeIn = Time()
    rstAssoc.Update

    DoCmd.Close acForm, "StartLog"
    DoCmd.OpenForm "Start"

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I suspect your friend got this code on the net; it's been floating around for a while. It was written by Dev Ashish. strTKNum = fOSUserName is referring to a function, fOSUserName and my guess is you didn't import the module that holds the function! You can find the function here. Copy it and place it in a module in your DB.

    http://www.mvps.org/access/api/api0008.htm
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Dec 2005
    Posts
    121
    That makes sense, I hadn't thought to look in the module section for a tie in. Thanks for the info.

Posting Permissions

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