If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Easy MS Access VBA problem.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-04-03, 06:23
philhowell philhowell is offline
Registered User
 
Join Date: Jan 2003
Location: UK
Posts: 27
Post 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
Reply With Quote
  #2 (permalink)  
Old 02-04-03, 09:27
Bruce A. Baasch Bruce A. Baasch is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 02-04-03, 12:27
philhowell philhowell is offline
Registered User
 
Join Date: Jan 2003
Location: UK
Posts: 27
Thumbs up Cheers worked first time...........

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

phil
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On