For this form, there are 4 main tables (below). Here is the pertinent detail for the tables involved.
tblProviderMain (table 1)
ProviderMainID (PK, Autonum)
tblProviderNumb ers (table 2)
ProviderNumberI D (PK, Autonum)
ProviderMainID (global join to tblProviderMain )
NumberType (types = Medicare, Medicaid, BCBS, et al.)
LocationCode (global join to tblLocations)
Number
tblLocations (table 2)
LocationCode (PK, Autonum)
tblProviderbyLo cation (table 3)
ProvbyLocationI D (PK, Autonum)
ProviderMainID (global join to tblProviderMain )
LocationID (global join to tblLocations)
The parent form is based on qry of tblProviderMain . I have a subform for each NumberType within tblProviderNumb ers (Medicare, Medicaid, BCBS, et al). I want to be able to select one of the locations for a provider, and make the data specific to that location appear in the appropriate box (subforms).
For example: I select Charles Brown on the parent form. He has 3 locations listed (Peanutville, Snoopy Town, and Schultzway) If I click on "peanutvill e," the Medicare number and related data for that record should appear in the Medicare subform. The number type subforms (ex: medicare) are fed by similar queries, the only difference being the number type.
I attempted to reach the desired goal in 2 different ways. A brief explanation of each follows:
1. Created a simple query to feed the location subform (to create a list of locations for each provider)
Expand|Select|Wrap|Line Numbers
- SQL = "SELECT tblProviderbyLocation.LocationID, " & _
- "tblLocations.LocationName, " & _
- "tblProviderbyLocation.ProviderMainID " & _
- "FROM tblLocations INNER JOIN tblProviderbyLocation " & _
- "ON tblLocations.LocationCode = tblProviderbyLocation.LocationID;"
2 The other attempt was to make a list box for the locations which was fed by a query of the tblLocations of only the location names. However, this listed ALL locations (not just ones specific to the provider in the active page).
If I could have gotten this method to work, I would have tried to add a FindRecord event procedure to the LocationCode control on the numbertype subform. I am unsure as to whether or not that would have worked, since I cannot get the first part to work.
I hope you can help. I appreciate any feedback.