Solved How to open customer record by double clicking in Listbox

NatAccessNewbie

New member
Local time
Today, 21:25
Joined
Jan 25, 2022
Messages
13
Hello

I've created a database for my customers. Upon opening my database, I have like a homepage "MainMenuF" that shows current orders "OngoingOrdersSF" and unpaid orders "UnpaidOrdersSF" It also has buttons to create a new order "NewOrderF" or to create a new customer "NewCustomerF"

I've also managed to add a listbox that shows all the customers I have on record, and I can search by surname to find certain customers. What I want to be able to do now, is open my customers details "CustomerDetailsF" by double clicking on the customer record in the list box.

I've got basic experience in Access but really struggle with it, so any help is massively appreciated :)

1663838680512.png
 
Hi Gasman thank you so much.

I've just gone into event properties for my list box and typed the following code in the On Dbl Click but I'm getting an error.

"DoCmd.OpenForm "CustomerDetailsF", , , "CustomerID=" & Me.CustomerID.Value"

1663849885120.png
 
So the control is not called that?
I would name a list control lstCustomer, along those lines?
You need to refer to the particular column number (they start at 0)

 
Where do can I find which column number I need to refer to?
I'll be honest I copied that code from my "OngoingOrdersSF" subform because I can click on the Customer ID in that and it brings up the relevant record.

Thank you so much for helping!

ps. I've just realised in the screenshot in my previous post, I've unintentionally highlighted .CustomerID in the code. I didn't mean too. Sorry if that's confused things. The name of the form that I want to open when I click on a customer in my list box is called "CustomerDetailsF" if that helps to make things any clearer?
 
Not really.
You need the name of the listbox and Column(0) if you want to use that number that is in the first column?
Don't even need to show it to use it. :)
 

Users who are viewing this thread

Back
Top Bottom