Copying related records from one form to another

c02dm

Registered User.
Local time
Today, 19:15
Joined
Apr 12, 2005
Messages
18
Hello,

I want to be able to double click on a record in a listbox (lstSubOrder) which uses (qrySubOrder), which in turn will open the orders form with the CustomerID, Title, FirstName and Lastname from the listbox copied into the corresponding fields on the orders form (tblOrders). I can do this with just fields from one table to another, but i dont know how to do it with fields from a listbox to a table.

The normal way if it was just fields from table to table for CustomerID would be;

Forms![frmOrders]!CustomerID.Value = Me![CustomerID].Value

Any ideas on how to do it, i've had a go and i cant figure it out.
 
Last edited:
You have to use the itemSelected property of the listbox. Look up listbox in VBA help.
 
Hi guys, still having problems with this code. I have looked up listbox in VBA help but it isn't helping too much. So far i've come to this to copy the CustomerID.

Forms![frmOrders]!CustomerID.Value = ListBox![lstSubOrder].Column(1).Value

The CustomerID is in the first column of the list box on frmOrdersName and i need to copy it into the CustomerID field on frmOrders. I've tried different ways and im stuck, can anyone help?
 

Users who are viewing this thread

Back
Top Bottom