comboBox

G

Guest

On my "Orders" form I have a combo box so user can search and find any
previosly saved order. there are two columns "orderID" ans "Customer Name."
Each cusotmer has one or more orders. As long as "OrderID" is the first
column in the combo box it works fine. However, users need to search for an
order based on customer name (by typing the first few letters and getting the
customer name and then selecting one of the orderId's) I put the
"customername" in the first coulmn of the comboBox and orderID in the
second. In the "afterUpdate" event I changed the "rs.FindFirst
"[CustomerName]" line to "rs.FindFirst "[OrderID] = ' " &
Me![comboBox].column(2) & " ' ". I had to do this because there are multiple
orders per cusotmer. But I am getting "run-time error date type mismatch" I
also tried "[OrderID] = ' " & Str(Nz(Me![ComboBox], 0))
 
G

Guest

Hi Moe,

If it was working fine with the OrderID as the first column, try setting the
column widths to 0; 4 which will hide the first column, therefore allowing
the user to type the first few letters...

Hope this helps.

Damian.
 
G

Guest

Thanks Damian
but it is not going to give me what I need. As I tried to explain in the
question there are more than one order per customer. If I hide the orderId
column then user will see multiple rows of the same "customerName" and will
not know which one to select.

Damian S said:
Hi Moe,

If it was working fine with the OrderID as the first column, try setting the
column widths to 0; 4 which will hide the first column, therefore allowing
the user to type the first few letters...

Hope this helps.

Damian.

Moe said:
On my "Orders" form I have a combo box so user can search and find any
previosly saved order. there are two columns "orderID" ans "Customer Name."
Each cusotmer has one or more orders. As long as "OrderID" is the first
column in the combo box it works fine. However, users need to search for an
order based on customer name (by typing the first few letters and getting the
customer name and then selecting one of the orderId's) I put the
"customername" in the first coulmn of the comboBox and orderID in the
second. In the "afterUpdate" event I changed the "rs.FindFirst
"[CustomerName]" line to "rs.FindFirst "[OrderID] = ' " &
Me![comboBox].column(2) & " ' ". I had to do this because there are multiple
orders per cusotmer. But I am getting "run-time error date type mismatch" I
also tried "[OrderID] = ' " & Str(Nz(Me![ComboBox], 0))
 
G

Guest

Ah... I see...

Usually a problem with selecting something from a combo as you have
described stems from having the wrong field bound - for instance, if it's
working fine with the field in the first column, you probably have the bound
field as column 1. If you move the Order ID to column 2, you will need to
change the bound field to column 2.

HTH.

D.

Moe said:
Thanks Damian
but it is not going to give me what I need. As I tried to explain in the
question there are more than one order per customer. If I hide the orderId
column then user will see multiple rows of the same "customerName" and will
not know which one to select.

Damian S said:
Hi Moe,

If it was working fine with the OrderID as the first column, try setting the
column widths to 0; 4 which will hide the first column, therefore allowing
the user to type the first few letters...

Hope this helps.

Damian.

Moe said:
On my "Orders" form I have a combo box so user can search and find any
previosly saved order. there are two columns "orderID" ans "Customer Name."
Each cusotmer has one or more orders. As long as "OrderID" is the first
column in the combo box it works fine. However, users need to search for an
order based on customer name (by typing the first few letters and getting the
customer name and then selecting one of the orderId's) I put the
"customername" in the first coulmn of the comboBox and orderID in the
second. In the "afterUpdate" event I changed the "rs.FindFirst
"[CustomerName]" line to "rs.FindFirst "[OrderID] = ' " &
Me![comboBox].column(2) & " ' ". I had to do this because there are multiple
orders per cusotmer. But I am getting "run-time error date type mismatch" I
also tried "[OrderID] = ' " & Str(Nz(Me![ComboBox], 0))
 
G

Guest

And then have to change the "afterUpdate" event, too. "AfterUpdate" event
looks for the first occurance of the filed in the first column. If my first
column is "customerName" then afterUpdate by default will look for that
unless I change it so it looks for the first occurance of the "orderID" that
is what I tried and did not work. Just take a look at the "afterUpdate" event
of a comboBox and see what I mean.

Damian S said:
Ah... I see...

Usually a problem with selecting something from a combo as you have
described stems from having the wrong field bound - for instance, if it's
working fine with the field in the first column, you probably have the bound
field as column 1. If you move the Order ID to column 2, you will need to
change the bound field to column 2.

HTH.

D.

Moe said:
Thanks Damian
but it is not going to give me what I need. As I tried to explain in the
question there are more than one order per customer. If I hide the orderId
column then user will see multiple rows of the same "customerName" and will
not know which one to select.

Damian S said:
Hi Moe,

If it was working fine with the OrderID as the first column, try setting the
column widths to 0; 4 which will hide the first column, therefore allowing
the user to type the first few letters...

Hope this helps.

Damian.

:

On my "Orders" form I have a combo box so user can search and find any
previosly saved order. there are two columns "orderID" ans "Customer Name."
Each cusotmer has one or more orders. As long as "OrderID" is the first
column in the combo box it works fine. However, users need to search for an
order based on customer name (by typing the first few letters and getting the
customer name and then selecting one of the orderId's) I put the
"customername" in the first coulmn of the comboBox and orderID in the
second. In the "afterUpdate" event I changed the "rs.FindFirst
"[CustomerName]" line to "rs.FindFirst "[OrderID] = ' " &
Me![comboBox].column(2) & " ' ". I had to do this because there are multiple
orders per cusotmer. But I am getting "run-time error date type mismatch" I
also tried "[OrderID] = ' " & Str(Nz(Me![ComboBox], 0))
 

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