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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a subbform control dependant on the value of another contr

Status
Not open for further replies.

WeeDram

Technical User
Jun 16, 2006
13
GB
I have a main form, where the users enter an order number. after hitting return, this opens a subform, filtered by the order number. The fields on the subform are either populated automatically from an underlying query, or manually input by the user. When all inputs are complete, a command button opens a report which is populated directly from the info in the subform.

One of the fields on the subform (a ship-to address) is currently auto populated, but for certain customers, the users want to overwrite this address. I've tried adding 2 controls ('ShipTo' and 'AltShipTo') for the Ship-To - which one is displayed dependant on the ship-to address of the customer. I've tried everything to make the appropriate control display without success, and don't know how then to get the report to display the contents of the correct control from the subform.
Hope someone can understand what i'm trying to say here....
 
How are ya WeeDram . . .

You don't open a subform. A subform opens when you open the mainform.

[blue]Be more specific about this![/blue] . . . perhaps your talking another independent form!

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1,
Thanks - you may have partly answered the question, as I thought a subform was treated as a separate form!

I should probably be driven by the After Update on the main form. When the subform opens (having been filtered on the Orderno field) if the 'ShipToNo' = xxxxxx, then make the 'AltShipTo' txtbox visible, if not, make the 'ShipTo' txtbox visible.

I'm having problems with how to write this in the Event Procedure.
 
WeeDram said:
[blue]When the subform opens (having been filtered on the Orderno field) [purple]if the 'ShipToNo' = xxxxxx[/purple], then make the 'AltShipTo' txtbox visible, if not, make the 'ShipTo' txtbox visible.[/blue]
[purple]If the 'ShipToNo' = xxxxxx[/purple], for whom? . . .
[ol][li]the current record?[/li]
[li]The entire recordset?[/li]
[li]What?[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
AceMan1,

The 'ShipToNo' is a code specific to a certain customer, and is auto populated when an OrderNo for this customer is entered in the main form. The User needs to overwrite the corresponding ShipTo Address for each order, hence having 2 controls for the ShipTo Address (ShipTo and AltShipTo). So, if the Orderno entered, refers to this customer, I want to open the 'AltShipTo' text box, otherwise, open the 'ShipTo' text box. Because the 'ShipTo' address is autopopulated from a query, it cannot be overwritten. This is fine in 99% of cases, but not for a specific customer.

I hope I'm making this clear - It's not always easy to clearly explain what you are trying to achieve!

Thanks for your help so far....

WeeDram
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top