PDA

View Full Version : Solved: Form Event



ProteanBeing
04-19-2008, 05:37 AM
I have a form that I want to put a combobox in. The contents of the combobox need to change depending on the value of another field in the record. Example:

The record has these fields:
Job Number (Primary Key)
Job Type
Current Operation

There is another Table that has:
Job Type
Operation Name

I originally tried to use a query and then create a form but I could not update any data on the form. So I am trying to update the combo box programmically.
If anyone knows how to fix either approach please help.

OBP
04-20-2008, 11:46 AM
You can do this with a combination of the 2 methods, or all in VBA.
The easiest is the combined approach
Assuming that the your Job Type is the controlling field on your Form then Create a Query for your Combo, in the Criteria Row of the Job Type field type in
forms![Form Name]![Job Type]
where Form Name is the Actual name of your form.
Now in the Form's On Current Event Procedure type in
Me.Combo#.requery (where the # in Combo# is the number of your Combo)
and also type it in the Job Type Field's After Update Event Procedure as well.

The first event takes care of current records and the second New records.

ProteanBeing
04-21-2008, 02:55 PM
You can do this with a combination of the 2 methods, or all in VBA.
The easiest is the combined approach
Assuming that the your Job Type is the controlling field on your Form then Create a Query for your Combo, in the Criteria Row of the Job Type field type in
forms![Form Name]![Job Type]
where Form Name is the Actual name of your form.
Now in the Form's On Current Event Procedure type in
Me.Combo#.requery (where the # in Combo# is the number of your Combo)
and also type it in the Job Type Field's After Update Event Procedure as well.

The first event takes care of current records and the second New records.

The forms![Form Name]![Job Type] does not work. It asks me to enter a parameter when I run the form.

OBP
04-22-2008, 04:05 AM
Did you use the Name of your Form?

ProteanBeing
04-22-2008, 05:00 AM
Yes

OBP
04-22-2008, 10:04 AM
Well that is very odd, I have been using that technique for at least 4 years now.

Trevor
04-22-2008, 03:40 PM
protean, It sounds like in your form properties, look at orderby on the format or data tab, I have run into the same situation, clear that box and you should be fine. Then you should be able to use queries or other form properties to programticly change the form

ProteanBeing
04-23-2008, 05:07 AM
Thanks for all your suggestions. I found the answer I needed on Microsoft (believe it or not).

CreganTur
04-28-2008, 08:25 AM
Thanks for all your suggestions. I found the answer I needed on Microsoft (believe it or not).

I'm interested in knowing what your solution was- mind sharing what you found?

ProteanBeing
04-28-2008, 09:10 AM
This is the link to the help: http://support.microsoft.com/default.aspx?scid=kb;en-us;209576