Application Terminating

G

Guest

I have an application that recently started to encounter a problem that I
can't find a solution for.

The application has a login form that requires the user to enter their id
and password and click "Login". The code opens another form and closes the
login form. On some machines MS Access quits completly. Here bis the code
behind the on click event:

***********
Private Sub btnCreate_Click()
On Error GoTo Err_btnCreate_Click
Dim rst As DAO.Recordset
Set rst = Me.Recordset
If IsNull(Me.txtID) Or IsNull(Me.txtCode) Then
MsgBox "You must enter a valid ID and Authenication Code.", vbCritical
Exit Sub
Else
If Me.txtID <> rst!ID Or Me.txtCode <> rst!AuthenicationCode Then
MsgBox "Invalid ID or Authenication Code." & Chr(13) & "Please try
again!", vbCritical
Else
strSignature = rst!AuthenicationCode
DoCmd.OpenForm "Resume"
DoCmd.Close acForm "frmUserLogin"

End If
End If

Exit_btnCreate_Click:
Exit Sub

Err_btnCreate_Click:
MsgBox Err.Description
Resume Exit_btnCreate_Click

End Sub
*****************

When I steped through the code it closed MS Access when the DoCmd.Close line
was executed. I remarked the line out and it still closed MS Access.

OS: Windows XP Home version 2002, SP2
MS Access 2000

If anyone has solution/reason it would be greatly appreciated.

Dwight
 
O

OldPro

I have an application that recently started to encounter a problem that I
can't find a solution for.

The application has a login form that requires the user to enter their id
and password and click "Login". The code opens another form and closes the
login form. On some machines MS Access quits completly. Here bis the code
behind the on click event:

***********
Private Sub btnCreate_Click()
On Error GoTo Err_btnCreate_Click
Dim rst As DAO.Recordset
Set rst = Me.Recordset
If IsNull(Me.txtID) Or IsNull(Me.txtCode) Then
MsgBox "You must enter a valid ID and Authenication Code.", vbCritical
Exit Sub
Else
If Me.txtID <> rst!ID Or Me.txtCode <> rst!AuthenicationCode Then
MsgBox "Invalid ID or Authenication Code." & Chr(13) & "Please try
again!", vbCritical
Else
strSignature = rst!AuthenicationCode
DoCmd.OpenForm "Resume"
DoCmd.Close acForm "frmUserLogin"

End If
End If

Exit_btnCreate_Click:
Exit Sub

Err_btnCreate_Click:
MsgBox Err.Description
Resume Exit_btnCreate_Click

End Sub
*****************

When I steped through the code it closed MS Access when the DoCmd.Close line
was executed. I remarked the line out and it still closed MS Access.

OS: Windows XP Home version 2002, SP2
MS Access 2000

If anyone has solution/reason it would be greatly appreciated.

Dwight

What is the purpose of the following line?
Set rst = Me.Recordset

I don't see you using rst, and what's more, if you do need it,
shouldn't it be set to recordsetclone?
 
G

Guest

OldPro said:
What is the purpose of the following line?


I don't see you using rst, and what's more, if you do need it,
shouldn't it be set to recordsetclone?

****
The rst is used in a couple of places:
If Me.txtID <> rst!ID Or Me.txtCode <> rst!AuthenicationCode Then
strSignature = rst!AuthenicationCode
 
A

Allan Murphy

Your line of code
DoCmd.Close acForm "frmUserLogin"
should be
DoCmd.Close acForm, "frmUserLogin"
put a comma between acForm and "frmUserLogin"

Another question
In Me.txtID <> rst!ID Or Me.txtCode <> rst!AuthenicationCode how do
you know whois the User logging in?

Allan
 
G

Guest

Allan,
Thank you for your response. The comma is actually in the code ~ I must
have somehow deleted it when I did this post.

The application is a single user application and does not require a login.
The code you asked about is to verify the user when applying and an
electronic signature before sending a document. The user created the
authenication code while setting up his/her profile, and then must use it
whenever he/she sends a document that requires a signature.

Any other ideas to what might be causing the problem. It works great on
most computers.
 
G

Guest

Correction to the response I gave to your question:
I got it confused with another application that does not require a login but
uses the same concept for the electronic signature.
Sorry!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top