Looking for coding help for a specific design

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok hoping you guys can help me like you have in the past.
I am trying to create a user form to display customer details in a
particular way.
The form is in 3 columns
Col1 = vertical scrolling column to show all customers name (you
highlight the name you want not double click)
Col2 = Box showing address of highlighted selection
Col3 = Box showing further details from another section of the database
ie prices

I saw this setup on a fancy Nokkia mobile phone and just saw it as a great
layout, the part that I will struggle on is creating the coding for when I
highlight.

Tables = Cust - Name, address, city
Prices - CustP, Item, Price

Col1 and Col2 will be using the same table - I will have no problems making
queries and such if required

Many thanks
 
CP said:
Ok hoping you guys can help me like you have in the past.
I am trying to create a user form to display customer details in a
particular way.
The form is in 3 columns
Col1 = vertical scrolling column to show all customers name (you
highlight the name you want not double click)
Col2 = Box showing address of highlighted selection
Col3 = Box showing further details from another section of the
database
ie prices

I saw this setup on a fancy Nokkia mobile phone and just saw it as a great
layout, the part that I will struggle on is creating the coding for when I
highlight.

Tables = Cust - Name, address, city
Prices - CustP, Item, Price

Col1 and Col2 will be using the same table - I will have no problems
making
queries and such if required

Many thanks

The "vertical scrolling column" could be a listbox control, populated with
the customer names in the Form_Load event. The other two "columns" can be
regular textbox controls, populated in the AfterUpdate event of the listbox.

Carl Rapson
 
Ok I created a form, added a list box which points to the customer name then
just added a random text box where I also added the customer name.

What I expect to happen is when I choose a customer in the list box that
name should change in the text box (as they are using related data) but the
text box only shows the first customer in the database regardless of what I
choose in my list box.

I know this is simple coding somewhere but not sure where to begin?
 
CP said:
Ok I created a form, added a list box which points to the customer name
then
just added a random text box where I also added the customer name.

What I expect to happen is when I choose a customer in the list box that
name should change in the text box (as they are using related data) but
the
text box only shows the first customer in the database regardless of what
I
choose in my list box.

I know this is simple coding somewhere but not sure where to begin?

Your "random text box" should not contain anything by default and it should
be unbound. You will set its value in the AfterUpdate event of the listbox.
Something like (I'm using made-up names here):

Public Sub lstListBox_AfterUpdate()
txtRandomTextBox = lstListBox
End Sub

If you want the textbox to display something other than what is selected in
the listbox, you can use the DLookUp method to fetch other values from a
table:

txtRandomTextBox = DLookUp("[Address]","[Cust]","[Name]='" & lstListBox
& "'")

There are a lot more details to think about here - for example, does each
customer in the Cust table have a unique identifier (such as a number), or
is each identified by the name itself? If there is a number for each
customer, you'll want to use that instead of the name string. You can set up
your listbox to contain both the customer number and customer name, but only
display the name. Then you wouldn't need quotes around the customer number
in the DLookUp:

txtRandomTextBox = DLookUp("[Address]","[Cust]","[ID]=" & lstListBox)

Do something similar to fetch values from the Prices table.

Read up on the listbox control to learn how to set up multiple columns and
"hide" some of the columns, and about the bound column of a listbox control.
Also read up on creating event procedures for controls on a form.

Carl Rapson
 
Back
Top