Macro question??

  • Thread starter TotallyConfused
  • Start date
T

TotallyConfused

I have inherited an Access db with the following code in a form. This code
references a macro. However, this db does not list any macros anywhere. Can
someone please explain this? Thank you.


Option Compare Database

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String

stDocName = "DoSomething"
DoCmd.RunMacro stDocName

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox "This information already in db."
Resume Exit_Command1_Click

End Sub
 
D

Dirk Goldgar

TotallyConfused said:
I have inherited an Access db with the following code in a form. This code
references a macro. However, this db does not list any macros anywhere.
Can
someone please explain this? Thank you.


Option Compare Database

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String

stDocName = "DoSomething"
DoCmd.RunMacro stDocName

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox "This information already in db."
Resume Exit_Command1_Click

End Sub


Possibly the macros have been hidden by the developer. If you go to the
View tab of the Tools -> Options... dialog and check the "Hidden objects"
box, do any macros now show in the Macros tab of the database window? Note:
if you're using Access 2007, the method for showing hidden objects is
somewhat different.
 
T

TotallyConfused

Thank you for responding. Looking in the Tools > Options and checking Hidden
Objects was my first inclination. Nothing in the Macros or Groups and that
is why I posted question on this forum. Just trying to understand this db.
Is there anything else? Thank you.
 
F

Fred Zuckerman

Does the Command1 button actually exist on your form? When you click on it
does anything happen? Is it possible that maybe once there was such a button
 
D

Dirk Goldgar

TotallyConfused said:
Thank you for responding. Looking in the Tools > Options and checking
Hidden
Objects was my first inclination. Nothing in the Macros or Groups and
that
is why I posted question on this forum. Just trying to understand this
db.
Is there anything else?

Does the code work? If you click the button, do you get an error? I notice
that, the way the error-handling is set up, you'll get the same message no
matter what sort of error is raised. That's bad design.

The code would compile perfectly well even without any existing macro by
that name. You wouldn't know anything was wrong until the code was actually
executed.
 

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