vbaformsms-accesscomboboxtabbed

MS Access Forms Query in Combobox does not work when placed on a tabbed page


MS Access 2013 query under Combobox OnChange works on the independent form but prompts for value when I place and run it under tabbped form form page. Here are the details of what I created:

Table:

Name: TblCustomers: 
Fields: CustID, CustName, CustRegion

Query:

Name: QryCustomers:
SQL: SELECT *
     FROM TblCustomers
     WHERE CustRegion = Forms!FrmCustomers!cmb_Region;

Form:

Name: FrmCustomers:
RecordSource: QryCustomers

Combobox (on form FrmCustomers):

Name: cmb_Region
Items: Asia, America, Europe, MiddleEast, RoW
OnChange VBA Procedulre: 
    Private Sub cmb_Region_Change()
        Me.Requery
    End Sub

Tabbed Form:

Name: CustomerApp
Page1: FrmCustomers

I run the form FrmCustomers independently, it works just fine. The same form I dragged on Page1 of tabbed form CustomerApp and tried to run, it prompts:

Enter Parameter Value:
Forms!FrmCustomers!cmb_Region

Please note, that I do not need the query to work independently.

How to make this form working both independently and on a tabbed form page?


Solution

  • i think the issue is in WHERE CustRegion = Forms!FrmCustomers!cmb_Region;

    originally CustRegion was found on FrmCustomers. but now that form is on another form!

    you'll need something like

    WHERE CustRegion = Forms!CustomerApp!TabControl.Form!FrmCustomers!cmb_Region;
    

    i forget the exact syntax right now but something like that.