Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Clickable Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curtis Stevens - 10 May 2007 18:12 GMT
I have this code as an onclick event for a button, but it is now crashing all
of a sudden for me when using it half the time.

On Error GoTo handler
Dim Msg, Style, Title, Response, MyString
Msg = "Run Update Query?"
Style = vbYesNo + vbDefaultButton1 + vbExclamation
Title = "Run Update Query?"

Response = msgbox(Msg, Style, Title)
If Response = vbYes Then    '

DoCmd.SetWarnings False
DoCmd.OpenQuery "UpdateAppEntry"
DoCmd.SetWarnings True

Else
End If
handler:
If Err.Number = 2498 Or 94 Then
End If
End Sub

==========================

UpdateAppEntry - is an update query

Any ideas or suggestions?

Curtis
Damon Heron - 10 May 2007 19:01 GMT
There is nothing wrong with this code, so the problem must be in the query.
Where is it crashing?

Damon

>I have this code as an onclick event for a button, but it is now crashing
>all
[quoted text clipped - 27 lines]
>
> Curtis
BruceM - 10 May 2007 19:35 GMT
A couple of things I noticed (I don't know if they matter):
If Err.Number = 2498 Or 94 Then
needs to be
If Err.Number = 2498 Or Err.Number = 94 Then

On another point, what is supposed to happen if the error number is
something other than 2498 or 94?  I would think the application could hang
if the error number is other than one of those two.

Try adding something like this before the handler line:

ProcExit:
   Exit Sub

Then in the error handler, something like:

   Select Case Err.Number
       Case 2498, 94
           Resume ProcExit
       Case Else
           MsgBox "Error #" & Err.Number & "(" & Err.Description & ") in
Procedure Name"
   End Select
   Resume ProcExit

Substitute the name of your procedure at the end of the MsgBox line.

On another point (unrelated to the current difficulties), you don't really
need Else in the code unless there is an Else condition.

>I have this code as an onclick event for a button, but it is now crashing
>all
[quoted text clipped - 27 lines]
>
> Curtis
Curtis Stevens - 10 May 2007 23:13 GMT
Bruce,

Ok, I tried this code & same thing.  This is what I'm doing.

I have a box I check on the form that makes a field in the table YES, which
is a criteria for this update query to run.  So when I select the check box
and click the button, it asks me to run it, I click yes and then scroll to
another record, but if I scroll back to the original record too fast, it
crashes!  But if I wait a second or two, it doesn't....

Curtis

> A couple of things I noticed (I don't know if they matter):
> If Err.Number = 2498 Or 94 Then
[quoted text clipped - 57 lines]
> >
> > Curtis
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.