Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Tab Problem

Status
Not open for further replies.

Ludington

Programmer
Oct 1, 2007
16
US
When I select a tab I am trying to run a macro but my macro isn't being executed. I know this because I placed a msgbox "Made it Here" command in the macro which doesn't display.

What is also weird; when I change my start-up option menu to "use access special keys" I get the following error: Run-time error 2465 "Can't find the field "|" referred to in your expression. When I remove the "use access special keys" option I don't receive the error message and the macro is not executed. The macro is not executed with or without the "use access special keys" option.

I am stumped...Ludington
 
Yes, I used the OnChange event for my Tabs.

Here is my vb code:

Private Sub TabCtl0_Change()
Select Case Me.TabCtl0.Value
Case Is = 0
Case Is = 1
Case Is = 2
DoCmd.RunMacro ([Test mac])
'DoCmd.RunMacro [Veteran Payment mac]
Case Else
MsgBox "Select Client, Data or Payment Tab"
End Select
End Sub

Test mac currently just displays a msgbox "Made it here"

FYI...Ludington
 
This is the code that I used and it worked exactly as expected in Access 2003
Code:
Private Sub TabCtl0_Change()
    Select Case Me.TabCtl0.Value
    Case 0
        MsgBox "Tab Zero"
    Case 1
        MsgBox "Tab One"
    Case 2
        MsgBox "Tab Two"
        'DoCmd.RunMacro [Veteran Payment mac]
    Case Else
        MsgBox "Else"
    End Select
End Sub

Duane
Hook'D on Access
MS Access MVP
 
I made my code the same as yours except adding the macro.

When it trys to execute the macro is were the problem is.

Have you ever tried to run a macro in the following sub routine?

Private Sub TabCtl0_Change()

 

DoCmd.RunMacro requires a string as the macro name.

DoCmd.RunMacro "Veteran Payment mac"

DoCmd.RunMacro "Test mac"


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks Missinglinq, that fixed the problem.

Sometimes the easiest fixes cause the most problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top