Fix the Access #Name? and Ambiguous Name Error in Currency Functions
Question details
The user needs to fix a #Name? error and an Ambiguous name detected error triggered by a custom Microsoft Access function designed to convert currency to words.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Using a custom VBA function within a form or report to dynamically convert numeric currency values into English text.
- Observed behavior
- The target form control displays a #Name? error instead of the text, and later throws an Ambiguous name detected error during database execution.
Before proceeding, open the VBA Editor (ALT + F11) in Microsoft Access to ensure your custom currency-to-words function is properly saved, and back up your database to prevent accidental data loss.
Fix Control References and Remove Duplicate VBA Names
Resolve the #Name? error by passing a fully qualified control reference, and eliminate the Ambiguous name detected error by removing duplicate module or function names.
The #Name? error typically occurs when Microsoft Access cannot find the field or control referenced in your expression. For instance, using 'txtAmount' without a proper qualifier tells Access to look for a non-existent name rather than the control's value. The 'Ambiguous name detected' error happens when Access finds multiple VBA components (like a module and a function) sharing the exact same name.
Ensure you are passing the correct currency value to your function. If referencing a field directly, use brackets like '[Amount]'. If passing a form control's value, use a fully qualified reference: 'Forms!YourFormName!txtAmount'.
Press ALT + F11 to open the Microsoft Visual Basic for Applications (VBA) window. In the Project Explorer pane on the left, check the names of all your Modules.
Ensure that the module containing your custom function does not have the same name as the function itself (e.g., if your function is named 'English', the module should be named something like 'modEnglish'). Rename any duplicates using the Properties window (F4).
In the VBA Editor, click 'Debug' in the top menu and select 'Compile Database'. This will highlight any remaining naming conflicts or reference errors. Save your changes once the compilation completes without errors.

Manage Your Financial Data Easily with WPS Office
While Microsoft Access is powerful for complex relational databases, dealing with VBA errors like #Name? and Ambiguous Name can be frustrating and time-consuming. For straightforward data tracking, financial calculations, and report generation, WPS Office provides a free, lightweight alternative with robust spreadsheet capabilities.
- 1. Download and install: Get WPS Office for free from the official website and install it on your device.
- 2. Open WPS Spreadsheet: Launch WPS Spreadsheet to import your existing tabular data or create a new financial tracker.
- 3. Utilize built-in functions: Use standard spreadsheet functions and custom formatting to manage your currency data without writing complex VBA database code.

Frequently Asked Questions
Why does Microsoft Access show a #Name? error in a form control?
This error occurs when Access cannot evaluate an expression in a control's Control Source. It usually happens if a field name is misspelled, a custom VBA function cannot be found, or a control reference is not fully qualified (e.g., missing the 'Forms!FormName!' prefix).
What causes the 'Ambiguous name detected' error in Access VBA?
This VBA error happens when there are two or more procedures (functions or subroutines), constants, or modules with the exact same name within the same scope. A common mistake is naming a VBA Module the exact same name as the Function placed inside it.
How do I properly pass a form control value to a custom VBA function?
To pass a form control value reliably in Access, use a fully qualified reference such as 'Forms!YourFormName!ControlName'. If you are referencing a bound field directly in the form's or report's record source, you can simply enclose the field name in brackets, such as '[Amount]'.




