View Full Version : What does "Ambiguous name in a query expression" really mean?


timo1999
09-04-2009, 07:16 AM
I am trying to write a cross tab query, with expressions that are saved as moduels in VBA form. Does this mean the expression is not recognized or possibly I have a syntax error?

You can view the attachment to see what I have on the screen. Thank you for your help in advance.:rolleyes:

pbaldy
09-04-2009, 07:28 AM
The two that come to mind are:

1) If the query pulls from 2 tables and a field name exists in both, you'd get that error if you didn't specify the table (TableName.FieldName). That doesn't appear to be the case here, as I only see one table listed.

2) If you have a module with the same name as the function, or 2 functions with the same name, you might get that error.

timo1999
09-04-2009, 07:59 AM
You were right, I do have an older module name with the same exact name. What I did was change the name of "ConvertFraction" to "FracToNum" in the VBA code (that I did not write), but now I'm getting a new error that says, "Compile Error: Sub or Function not defined.

I do not know how to program VBA, but I do have a general understanding of it. I am attaching a new screenshot. Does this mean I have to use a predifined name, or add another line of code?

MSAccessRookie
09-04-2009, 08:02 AM
You were right, I do have an older module name with the same exact name. What I did was change the name of "ConvertFraction" to "FracToNum" in the VBA code (that I did not write), but now I'm getting a new error that says, "Compile Error: Sub or Function not defined.

I do not know how to program VBA, but I do have a general understanding of it. I am attaching a new screenshot. Does this mean I have to use a predifined name, or add another line of code?

Is FracToNum() Defined in a Common Module as a Public Function?

pbaldy
09-04-2009, 08:04 AM
And it's highlighting the Round function? That sounds like a reference problem:

http://www.accessmvp.com/djsteele/AccessReferenceErrors.html

timo1999
09-04-2009, 08:46 AM
Yes, FracToNum is defined as a common module as a public function. You can see the code in the jpg I attached titled, "define"

If it is a reference problem, then I guess I am stuck, because I don't know VBA that well to check that. I will read the link you sent and hopefully try to gain a better understanding. Thanks for your help!!!! If you think of anything else, please let me know.

tim

boblarson
09-04-2009, 08:51 AM
If it is a reference problem, then I guess I am stuck, because I don't know VBA that well to check that.
A visual (http://www.btabdevelopment.com/main/QuickTutorials/Howtocheckformissingreferences/tabid/71/Default.aspx) on that.

timo1999
09-04-2009, 09:28 AM
OK, so I'm in the code, and I go to TOOLS;REFERENCES. The REFERENCES text is ghost text, and I can't click on it.:(

I can click on the other choices such as "Active X" "add-ins" ect.

I'm so close, yet so far...

boblarson
09-04-2009, 10:43 AM
OK, so I'm in the code, and I go to TOOLS;REFERENCES. The REFERENCES text is ghost text, and I can't click on it.:(

I can click on the other choices such as "Active X" "add-ins" ect.

I'm so close, yet so far...

You may have to first click on RUN > RESET

DCrake
09-07-2009, 03:40 AM
Tim

Can you post a copy of your mdb here or over on AccessForums (where I have been dealing with this issue for you for the past couple of weeks.)

David