Dynamic Parameter Query

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a form that has a couple of combobox's. The first
combobox is populated from a query that generates a list
of course names. Each one of these course names has a
corresponding list of sections. I have a dynamic
parameter query:

SELECT [SECNUM]
FROM Course
WHERE Course.COURNUM=Forms!Results1!COURNUM;

Now the problem I am running into is that on the data
entry form the query works properly if run separately for
the corresponding entry on the form. However when I open
the form the combobox only populates a list that
corresponds to the first entry, when i move to the next
entry, the list doesn't change and remains the same list
on any entry.

When i change entries on the form and run the query
seperately it works right. Any help please?

Thank you
 
haven't got a clear picture of how your form is set up, but...

to update the combo box in existing records, write code on the form's
OnCurrent event, as

Me!ComboBoxName.Requery

to update the combo box in response to data entry in a record, add the above
code to the AfterUpdate event of control Forms!Results1!COURNUM.

hth
 
I appreciate the reply, and kinda understand what you
mean...but i am really new to this and don't really get
what the 'Me' is supposed to mean. Can you help me out on
this? Thanks

-----Original Message-----
haven't got a clear picture of how your form is set up, but...

to update the combo box in existing records, write code on the form's
OnCurrent event, as

Me!ComboBoxName.Requery

to update the combo box in response to data entry in a record, add the above
code to the AfterUpdate event of control Forms!Results1! COURNUM.

hth


I have a form that has a couple of combobox's. The first
combobox is populated from a query that generates a list
of course names. Each one of these course names has a
corresponding list of sections. I have a dynamic
parameter query:

SELECT [SECNUM]
FROM Course
WHERE Course.COURNUM=Forms!Results1!COURNUM;

Now the problem I am running into is that on the data
entry form the query works properly if run separately for
the corresponding entry on the form. However when I open
the form the combobox only populates a list that
corresponds to the first entry, when i move to the next
entry, the list doesn't change and remains the same list
on any entry.

When i change entries on the form and run the query
seperately it works right. Any help please?

Thank you


.
 
Me is a way to refer to the form where the combo is located. It is a
shorthand for Forms!MyForm.

in the VB editor, working in a form's code module, when you type me followed
by a perid, you will see a list of all the properties and conmtrols fro that
form. Just select the combo you are working with.

Ragnar
 
Back
Top