Select a Customer from ListBox????

  • Thread starter Malik via AccessMonster.com
  • Start date
M

Malik via AccessMonster.com

Hi
I Have a form "FrmSales" with several fields as customer Id and Customer Name.


After CustomerId And CustomerName I have a small button by pressing it a new
farm appears with a list box having all my customers Id's and names....

I want that by double clicking on a customer name in list box, It fill up the
CustomerId and Name feild in the FrmSales with selected Customer from Listbox.


Thanks.
 
A

Arvin Meyer [MVP]

Aircode:

Sub ListBoxName_DblClick()
Me.CustomerIDControlName = Me.ListBoxName
Me.CustomerName = Me.ListBoxName.Column(1)
End Sub

A list box can have many columns, the first is usually the ID field and it
is Column(0). Being the bound column, it isn't necessary to identify the
column index. Customer name can be hidden (ColumnWidth set to 0) or visible,
and the second column is Column(1)

While the CustomerID is require on a sales form, the Name isn't stored in
the table, so do not bind the CustomerName to the underlying field. In the
form's current event, you can display the customer name, by binding it to an
underlying query.
 
M

malik via AccessMonster.com

Arvin said:
Aircode:

Sub ListBoxName_DblClick()
Me.CustomerIDControlName = Me.ListBoxName
Me.CustomerName = Me.ListBoxName.Column(1)
End Sub

Thanks Buddy

But My List Box is exist in another form named "FrmListCustomers", Not in
FrmSales.


Now tell me what to do ???
 
D

Douglas J. Steele

malik via AccessMonster.com said:
Thanks Buddy

But My List Box is exist in another form named "FrmListCustomers", Not in
FrmSales.

Me.CustomerName = Forms!FrmListCustomers!ListBoxName.Column(1)
 
M

malik via AccessMonster.com

I think It Will Be As:

Sub ListBoxName_DblClick()
[Forms]![FrmSales].[TxtCustomerId] = Me.ListBoxName


End Sub

I think Its Correct..

Thanks Bro.

Some Time I think That I could not make a single table If i did not join this
Forum..

People on this forum are very HelpFul..

Thanks Again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top