List Box Selection

creativefusion

Registered User.
Local time
Tomorrow, 00:26
Joined
Oct 21, 2009
Messages
13
Hi All,

I have a form that contains 9 list boxes. Each list box name contains Pod and a unique number. As Pod1, Pod2, Pod3 etc..

Each list box is populated with RefNo and StateCode

Now, I need to write a function that identifies the above 2 values based on the users selection. So when the user highlights a records in any of the 9 list boxes, my function will retrieve the RefNo and StateCode and use these to delete the record from the underlying table.

Has anyone got any suggestions for me?
 
I'm curious why there are 9, but this type of thing:

CurrentDb.Execute "DELETE * FROM TableName WHERE RefNo = " & Me.ListboxName.Column(0) & " AND StateCode = " & Me.ListboxName.Column(1)

That assumes the listbox is single select and both values are numeric.
 
Hi Paul,

Thanks very much for your help.

The reason there are 9 lists boxes is because I have 9 shipping ports to discharge product into. My application lets users build multiple shipments for various ports. So, each list box displays all the products that are planned for shipping into each port. Do you think there is a better way to do this? I am all ears...

Thanks again.
Shaun
 
I would keep all of the data in one table and have a field which identifies which port the record relates to.
 

Users who are viewing this thread

Back
Top Bottom