Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

chaosguy (Programmer) (OP)
28 Nov 05 10:29
I have no idea what happened, but my change password form just stopped working. The code below is used on the cmdChange_password button. It get an error in the second line everything I try to change the password saying
"Compiler error,  user-defined type not defined."
It worked when I just wrote the code, but not it's not working, lol. Can anyone help, I mean do anyone know why?

Here's the code

Private Sub ChangePass_Click()
    Dim ThisDB As DAO.Database        ---------> error in this line here.
    Dim rstPassword As DAO.Recordset
    
    If IsNull(Me.CurrentPass.Value) Then
        MsgBox "You must enter the current password before changing.", vbExclamation, "Password Not Changed."
    ElseIf IsNull(Me.NewPass.Value) Then
        MsgBox "You must enter a password before saving changes.", vbExclamation, "Password Not Changed."
    ElseIf Me.CurrentPass.Value <> DLookup("Password", "tblPassword") Then
        MsgBox "The current password you have entered is incorrect.", vbExclamation, "Password Not Changed."
    ElseIf Me.NewPass.Value <> Me.CurrentPasscheck.Value Then
        MsgBox "The passwords you have entered do not match!", vbExclamation, "Password Not Changed."
    Else
        Set ThisDB = CurrentDb()
        Set rstPassword = ThisDB.OpenRecordset("tblPassword", dbOpenDynaset)
        
        ThisDB.Execute "DELETE * FROM tblPassword;", dbFailOnError 'Clear table to ensure only one password
        
        With rstPassword
            .AddNew
                !Password = Me.NewPass.Value
            .Update
        End With
    
        rstPassword.Close
        ThisDB.Close
        Set rstPassword = Nothing
        Set ThisDB = Nothing
        MsgBox "Your Password have been changed"
        DoCmd.Close
    End If
End Sub

Chaosguy - To die would be an awefully big adventure.

Helpful Member!  gwinn7 (Programmer)
28 Nov 05 10:35
Check your References when you have the code in view.   You may have issues with that and make sure DAO is checked.

Gary
gwinn7
chaosguy (Programmer) (OP)
28 Nov 05 13:55
say what? :s "I'm confused"

Chaosguy - To die would be an awefully big adventure.

Helpful Member!  PHV (MIS)
28 Nov 05 14:02
When in VBE, menu Tools -> References ...
Check that the Microsoft DAO 3.x library is ticked.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

jadams0173 (TechnicalUser)
28 Nov 05 14:05
What gwinn7 is suggesting is that in the VBA code view (where you write code) select TOOLS-->REFERENCES and make sure that Microsoft DAO Object Library is checked.
MajP (TechnicalUser)
28 Nov 05 15:18
Chaosguy,
  Think of a reference as a door to a tool room.  Once you open the door you can use the tools within the room.  In side each tool room is a related group of objects and methods.  For example if you wanted to work with Excel objects you make a reference to Excel.  DAO is a group of objects designed to work with the data in data bases. ADODB is another group.
  If you do not have the reference established ("the door is open") when you do this:

dim rstPassword as dao.recordset

VB does not know where to go to find a dao.recordset object.  It goes through each open door ("reference") looking for a dao.recordset, but never finds one so it thinks that you are trying to define your own.
Hence you get the user defined type error.
chaosguy (Programmer) (OP)
28 Nov 05 18:44
Oh, well thanks guys, big help, big help. Gwinn thanks very much and I gaved ya a star. Also gaved PHV a star for breakign it down for a cad like myself :$. Anyways thanks and it works fine now. I don't know how it got unticked tho cause it was working fine at first. Oh well works now so that's all that matters. Thank you so much guys.

Chaosguy - To die would be an awefully big adventure.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close