Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    UK
    Posts
    27

    Post Unanswered: Easy MS Access VBA problem.

    i'm running a simple form in MS access that updates a form text box with the users password when the users name is seleceted in a combo-box, but it throws up an error saying.........

    run-time error 2465

    it throws up the error on the line

    frmUser = Form.ChangeLotusPWD.User.Value

    saying it can't define it........ ???

    Any pointers are welcome.
    Thanks
    Phil

    *******************************
    Below is the VBA code


    Private Sub User_Change()

    ' define variables
    Dim varX As Variant
    Dim frmNewPWD
    Dim frmUser
    Dim frmOldPWD

    frmUser = Form.ChangeLotusPWD.User.Value

    varX = DLookup("[PWD]", "5_LotusPwds", "[UserName]= '" & frmUser & "'")

    If IsNull(varX) Then
    varX = " "
    Else
    End If

    ' update users password so it display the relevant one based on the user name selected
    Forms.ChangeLotusPWD.OLDPWD.Value = varX

    ' ensure that the New password text box on the form is empty
    Forms.ChangeLotusPWD.NEW_PWD.Value = " "

    End Sub

  2. #2
    Join Date
    Nov 2002
    Location
    Ohio
    Posts
    90
    Hi philhowell,

    Try changing "Dim frmUser" to Dim frmUser as String".

    If that doesn't clear it up, insert code to print the contents of the
    Form........Value field. You might be getting an unexpected data type.

    If that doesn't help, try using "Set frmUser = Form....Value".

    Good Luck,
    Bruce Baasch

  3. #3
    Join Date
    Jan 2003
    Location
    UK
    Posts
    27

    Thumbs up Cheers worked first time...........

    Cheers worked first time...........

    phil

Posting Permissions

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