Solved

Forms works in isolation BUT NOT as a sub form

Posted on 2011-09-02
5
267 Views
Last Modified: 2012-05-12
Example: I sell car parts !  I have a combo for the make of car.   Depending on the make chosen I have a combo for the model of car.  Depending on the model chosen I have a combo for the car part etc.

See frmOrdDetTypes which has 4 drop downs which work fairly well (not perfectly).

However, if I put frmOrdDetTypes in frmCustomers and then run frmCustomers - ERRORS! when if go into the sub form frmOrdDetTypes

Why does frmOrdDetTypes work on its own but NOT as a sub form

KeylightMaintenance.zip
0
Comment
Question by:Patrick O'Dea
  • 2
  • 2
5 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36476133
it works here!!!

try doing a compact and repair
0
 

Author Comment

by:Patrick O'Dea
ID: 36476189
Thanks capricorn1,
Are you saying that you can run frmCustomers and then go into subForm frmOrdDetTypes and then choose from the 4 levels of drop downs - with no errors  ??

0
 
LVL 14

Accepted Solution

by:
pteranodon72 earned 250 total points
ID: 36476201
It will work if frmOrdDetTypes is open as a main form, but not as you want

The problem is each query's references to Forms!frmOrdDetTypes!ComboX. This type of notation expects that frmOrdDetTypes is open as a main form, not a subform. The queries bomb won't run if frmOrdDetTypes is not open / open only as a subform.

You can get around this by changing the criteria in each query to [Combo6], [Combo14], etc. without the Forms!frmOrderDetTypes!

This way, the query finds a value for [Combo6] within the context of the current form.

HTH,
pT72
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
ID: 36476294

test this

the format for the reference is

forms!nameofmainform!subformcontrolname.form!controlname
KeylightMaintenance.accdb
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 36477244
Thanks guys!  Great explanations!
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now