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

Dynamic Listbox

Status
Not open for further replies.

ychousa

MIS
Jun 11, 2003
82
US
Hi. I have a frmOrder as a subform inside a frmDetail. frmOrder gets values such as DetID automatically from frmDetail. DetID is an autonumber and a primary key in tblDetail which is a base for the frmDetail. What I want to is to dynamically change the list in the listbox on frmOrder depending on the change of DetID on frmOrder.

Right now frmDetail doesn't have a DetID textbox on it. It is just generated and transfered to frmOrder depending on other inputs.

Thank you for your comments in advance.
 
Since frmOrder is a subform of frmDetail and linked by DetID, the only time DetID should change in frmOrder is when it changes in frmDetail, right? If that is the case then update the listbox in the Form_Current event of frmOrder. If that is not the case then what is your subform linked by?
 
Thank you for your reply, Schof.

The frmOrder(subform) is linked by DetID,SID, and SYear with frmDetail. Actually, frmDetail is a subform in anther frmMain which only has SID and SName as primary keys, but I think I need to deal with only frmDetail and frmOrder in this case(Am I right?).

The only field with "NO DUPLICATE" is DetID, but frmOrder gets the values of DetID, SID, and SYear from frmDetail.

The listbox shows Salesorder Number and Customer Name based on tblOrder, which is a base table of frmOrder.

Could you give me the right syntax for perform this action?

I followed some suggestions, but neither of them worked correctly.

thanks alot.

John
 
You said that frmDetail doesn't have a DetID textbox so I am assuming the user changes it's value in frmMain. If frmDetail updates properly when the value of DetID changes then try putting this code in frmOrder to update the listbox:

Private Sub Form_Current()
Me.frmOrder.Form.ListboxControlName.Requery
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top