Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using subform within form

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi,

I have a form that uses a subform as well.
On the 'Form_Open' event of my main form, I use VBA to set all 'Condition' list boxes to values 1 through 5. My subform also has 'Condition' list boxes. But where do I set these values for my subform? In the Form_open event of my main form, or in the form_open event of the subform? (or somewhere else?). I have tried setting them in the Form_open event of my main form, but get an error. Can someone also please verify, depending on location of the code, how to reference the fields on the subform, which has as a table as its control source.

THANK YOU!
Lori
 
Hi Bill,
Sorry, I don't know what you mean by setting the condition for the subform. Can you be more specific?

Thanks,
Lori
 
I have no idea what you mean by "condition" of list boxes but you could put code in the On Open event of your subform to change properties of controls on the subform.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Oops, sorry I was unclear. My field name is actually called 'CONDITION' (keeps track of condition of each item in a hotel room). Misleading, with Access conditions.

I want to create a Value List of: 1,2,3,4,5, for each condition's combination box. I'd prefer to do it via VBA rather than each field's properties, so if these values ever change, they can all be done in one spot, with one piece of code. I have the logic working in the main form, but don't know where to put it for the subform.

I will try putting it in the subform's On Open event and let you know.

Lori

 
Since we're using a database, why not try a lookup table in stead;-)

Use rowsourcetype of table/query, and get even easier maintenance...

This is perhaps more a forms question than a reports question. Perhaps consider the forms forum for further form questions (forum702)?

Roy-Vidar
 
Roy-Vidar,

A lookup table is a GREAT idea! I hadn't thought of that...
and I didn't realize I had posted to the Reports forum...

Thanks on both counts,

Lori
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top