Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!
  • Students Click Here

*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.

Students Click Here


why did it stop working?

why did it stop working?

why did it stop working?

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."
        Set ThisDB = CurrentDb()
        Set rstPassword = ThisDB.OpenRecordset("tblPassword", dbOpenDynaset)
        ThisDB.Execute "DELETE * FROM tblPassword;", dbFailOnError 'Clear table to ensure only one password
        With rstPassword
                !Password = Me.NewPass.Value
        End With
        Set rstPassword = Nothing
        Set ThisDB = Nothing
        MsgBox "Your Password have been changed"
    End If
End Sub

Chaosguy - To die would be an awefully big adventure.

RE: why did it stop working?

Check your References when you have the code in view.   You may have issues with that and make sure DAO is checked.


RE: why did it stop working?

say what? :s "I'm confused"

Chaosguy - To die would be an awefully big adventure.

RE: why did it stop working?

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

RE: why did it stop working?

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.

RE: why did it stop working?

  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.

RE: why did it stop working?

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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