PC Review


Reply
Thread Tools Rate Thread

combobox problem in a simple form!SOS!

 
 
New Member
Join Date: Jun 2010
Posts: 5
 
      3rd Jun 2010
Hello everyone,
I experience the following problem.

I have form1(datasheet view) which get records from table1.
In this Form1 there are 4 fields customer_id,Name,Surname and Address.
Address is a combo box which gets records from a query (customers_and_address_query :

SELECT cust.customer_id,cust.name,cust.surname, addr.street
FROM cust INNER JOIN addr ON cust.customer_id = addr.customer_id
WHERE (((cust.customer_id)=[Forms]![Form1]![customer_id]));
)

The problem is that when i choose an address from the combobox for a specific customer(e.g. the 1st record of the Form1) ,when i move to another record ,the records of that combobox are still the same as the ones of the 1st record(1st customer).

I tried the following code but the problem persists.address1 is the name of the combobox.

Private Sub address1_AfterUpdate()

Me!address1.Requery

End Sub

Additionaly,if i select something from the combobox for the 1st record-customer of the Form1 its ok,but when i move to the 2nd record of the Form1 and try to select something from the combobox (it has similar records regarding the records of the combo for the 1st record of the form as i explained above) ,the record of the combo for the 1st customer of the Form1 disappears!!!

Can anyone help me with these 2 problems???

Thank you in advance!
 
Reply With Quote
 
 
 
 
New Member
Join Date: Jun 2010
Posts: 5
 
      4th Jun 2010
The combo box is bound to the relevant field of the table that the whole form depends on (Table1).

Here is what i really want:

In my database i have seperate tables for Customers and their addresses and phones,that is to say a customer may have 2 or more addresses or phone numbers.

So in this Form i have customer name and surname and 2 combo boxes for address No1 and address No2 of the customer.I want in both of these combos to be visible all the addresses of each customer so that i can select from these combos which of them i want to be AddressNo1 and AddressNo2.

It must be something with the after update event of the combos or the on current of the form but i dont know well vba.

Can you help me?
 
Reply With Quote
 
New Member
Join Date: Jun 2010
Posts: 5
 
      4th Jun 2010
In the Current event procedure of the form i tried this:
Me!address1.RowSource = Me!address1.RowSource

but it still has problem.

When i select something inside the 1st combo regarding 1st record of the form,this selection remains and it is visible.

But when i move to the 2nd record of th form ,that selection from the combo that i selected for the 1st record disappears.

Again,When i move back to the first record it becomes visible but the selection of the 2nd combo disappears.
 
Reply With Quote
 
New Member
Join Date: Jun 2010
Posts: 5
 
      4th Jun 2010
The combo boxes are not cascading

The bound field of the combo is Address1 on table1.All records for this field in this table are Null from the start.This table has only values for the customer id name surname,but it has null values for the address1 field.

So ,in form1 which depends on table1 the user sees values only in customer id name and surname .The combo box address1 has null values.When i select something from the combo box i want it to be automatically saved in the correspondent field address1 of the table1 (which is bounded to).Each combo in this datasheet displays addresses (getting records from a query which joins table with addresses and table with customer details) that are filtered by the Form_field_Addresses1.

SELECT cust.customer_id,cust.name,cust.surname, addr.street
FROM cust INNER JOIN addr ON cust.customer_id = addr.customer_id
WHERE (((cust.customer_id)=[Forms]![Form1]![customer_id]));
)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Please help me with updating a form combobox (or table field) based on the choice of a different form combobox Ken Snell \(MVP\) Microsoft Access Forms 0 8th Oct 2007 12:37 AM
Form ComboBox problem cmpcwil2 Microsoft Excel Programming 3 24th Apr 2006 09:05 AM
Form.CancelButton doesn't work with a Simple ComboBox =?Utf-8?B?T2xpdmllciBGZXJteQ==?= Microsoft Dot NET Framework Forms 0 19th Dec 2005 02:06 PM
ComboBox in Main Form Problem JKK Microsoft Access Forms 3 15th Mar 2005 01:39 AM
help with simple combobox problem in Visual C++ =?Utf-8?B?ZHQ=?= Microsoft VC .NET 2 24th Dec 2004 07:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 AM.