limiting data in combo box based on form

G

Guest

Hello,
I have MainForm; SubForm1; SubForm2

The MainForm contains a JobNo and SubForm2 has Charge Numbers in a combo
box. I want to limit the Charge Numbers in the Combo Box based on the
Current Job displayed in MainForm. The Charge No and JobNo have a
many-to-many relationship. One Charge Number can be on many Jobs and one Job
can have several Charge Numbers. I have a table to link the ChargeNo and
JobNo, lets call it tblLink. tblLink is used in the ComboBox Charge No query.

I tried to input criterion in the Charge Number Combo Box query. The
criterion was the JobNo MainForm name and the JobNo field in the JobNo Field
of the query. However, the query doesn't seem to recognize the form. I
probably need something on the MainForm OnCurrent Event, also. There seems
to be so many ways to approach this but I have not been able to do this
successfully.

Your help will be appreciated.
Captain OhNo
 
G

Guest

Hi All,
Saturday is a slow day, I am replying to my own question. I solved the
below problem: I was on the right track, I just had to put in the correct
syntax in the criteria of the query, referencing the Job No on the MainForm.

That problem being solved, I am trying to have the combo box requery on each
new record in Main form.

In the On Current event of Main Form, I input

comboBoxname.requery

It doesn't work. So I input the full path
Forms!Mainform.Subform1.Subform2.Form.ComboBoxname.Requery. The error
message is that the form is not recognized.

Thanks again for the assitance.
Capt OhNo
 
T

tina

try

Me!Subform1ControlName!Subform2ControlName!ComboboxName.Requery

(all on one line, of course.) make sure you're using the name of the subform
CONTROL name in each parent form. sometimes it's the same as the name of the
subform in the database window, but sometimes it is not. to get the correct
name, open the main form in design view, click on Subform1 (within the main
form) once to select it, in the Properties box click on the Other tab, and
look at the Name property. to get the correct name for the Subform2 control,
open Subform1 in design view *from the database window*, click on Subform2
(within Subform1) once to select it, etc, etc.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top