Small Macro Help

agamer91

New member
Local time
Today, 13:01
Joined
Dec 7, 2011
Messages
5
Hey guys I'm working on one of my first macros. I am using this macro to open up another form and display a specific record. The record to go to is determined by a combo box.

I am using the open form command with the form name, and then the where clause to open the specific record within that form. I can get the form to open, but I cannot seem to get the where clause to work and open a specific record.

Here is what I have...

[RecordID]=[Combo10].[Column](1)

With this build event I get "Undefined function [Combo10].[Column] in Expression"

I don't understand why this is. I know that =[Combo10].[Column](1) works because if I use the macro to open a dialog box and set the contents as ="[Combo10].[Column](1)" I get the desired number in the dialog.

Also, I know that the where clause with "[RecordID]=" works because if I set the where clause to "[RecordID]=5" it takes me to the desired record.

On a separate note, I was wondering if there was a way to switch tabs within a navigation form through the macro. Right now I am opening a new form, but this form is actually within a different tab of the main navigation form.
 
Hmm, idk about the full reference because each side of the equation works separately, they just don't work together.
 
But you haven't tried? I don't use macros, but the example in help uses the full form reference.
 
I tried it and I got the same results.

[RecordID]= (any number) works
and
=[Combo10].[Column](1) works

I don't see why [RecordID]=[Combo10].[Column](1) doesn't work. It is quite frustrating.
 
Have you tried the full form reference??

[RecordID]=Forms!FormName.Combo10.Column(1)
 
Unfortunately that did not work, I'm still receiving the same error. These Macros are giving me a head ache.
 
Did you try the VBA code instead? Unless you're in a 2010 Web db, I'd use code.
 
Could it be that macros like querys do not know what .Column(x) is??

You could perhaps use Eval() function to resolve this.

[RecordID]=Eval("[Combo10].[Column](1)")

or

[RecordID]=Eval("Forms!FormName.Combo10.Column(1)")

JR
 
I tried your suggestion, too JANR. I am getting the same error. And the Macro does know what "[Combo10].[Column](1)" is. I can display a message with it's value. I just can't use it to set a field's value for some reason :(
 

Users who are viewing this thread

Back
Top Bottom