473,503 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show results of union query in combobox

284 Contributor
I had two tables, one new customers and the other new suppliers.

Now I want to show all the customer and suppliers in one combo box.

I am using a recordset by coding

Expand|Select|Wrap|Line Numbers
  1.  
  2. recordset1.open "select name from newcustomer union all select name from newsupplier" 
  3. combobox1.rowsource = recordset1
  4. combobox1.listfield = "name"
  5.  
When I use a union clause it does not show the name in combo box. When I use only one table it works.

Remember I already made the name columns of both table as primary key so how can I show names from two or more tables in one combo box?
Dec 22 '07 #1
10 1802
Ali Rizwan
925 Contributor
Why don't you use a Do While loop to add contents in combo?

If you don't know the procedure I'll send it to you.

Eid Mubarik

>> ALI <<
Dec 22 '07 #2
debasisdas
8,127 Recognized Expert Expert
Open separate recordsets and add to the combo in a loop.
Dec 22 '07 #3
muddasirmunir
284 Contributor
i will try to make a loop
Dec 22 '07 #4
Ali Rizwan
925 Contributor
i will try to make a loop
Expand|Select|Wrap|Line Numbers
  1. Adodc.Recordset.MoveFirst
  2.  
  3. Do While Not Adodc.Recordset.EOF
  4.   Combo1.Additem (Adodc.Recordset.Fields (0))
  5.   Adodc.Recordset.MoveNext
  6. Loop
This is for Adodc. You can use this for adodb also.

Regards

>> ALI <<
Dec 22 '07 #5
muddasirmunir
284 Contributor
first i made a view containg all the name of customers and
supplier and then make a adodc connection to it

and when i write the code its give me the error
"object variable or with block variable not set"

what wrong with it



Expand|Select|Wrap|Line Numbers
  1. Adodc.Recordset.MoveFirst
  2.  
  3. Do While Not Adodc.Recordset.EOF
  4.  
  5. Combo1.Additem ( Adodc.Recordset.Fields (0))
  6. Adodc.Recordset.MoveNext
  7.  
  8. Loop
This is for Adodc u can use this for adodb also

Regards

>> ALI <<
Dec 22 '07 #6
Ali Rizwan
925 Contributor
first i made a view containg all the name of customers and
supplier and then make a adodc connection to it

and when i write the code its give me the error
"object variable or with block variable not set"

what wrong with it
Replace Adodc with Adodc1.
OK

Regards

>> ALI <<
Dec 22 '07 #7
muddasirmunir
284 Contributor
i had used the name adodc1 still its give error.
now , instead of using this
i had made a new table which contain all the name of
customers and suppliers
so this fulfill my task

Replace Adodc with Adodc1.
OK

Regards

>> ALI <<
Dec 23 '07 #8
Ali Rizwan
925 Contributor
i had used the name adodc1 still its give error.
now , instead of using this
i had made a new table which contain all the name of
customers and suppliers
so this fulfill my task
Is the problem solved or not?
Or ill make an example of it?

Regards

>> ALI <<
Dec 23 '07 #9
muddasirmunir
284 Contributor
problem is solved

thanks



Is the problem solved or not?
Or ill make an example of it?

Regards

>> ALI <<
Dec 24 '07 #10
debasisdas
8,127 Recognized Expert Expert
We are glad to know that the problem is solved by help of our memebers.

Feel free to post further questions in the related forum only.
Dec 24 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4969
by: Alan | last post by:
I'm just about to start a project that needs to combine the results of a SQL Server query with the results of an Index Server query. The basic idea is that the user enters/selects a bunch of search...
3
12876
by: Matt O'Donnell | last post by:
Does anyone know how I can 'join' the results of one SQL query to the bottom of another? Eg. I have two queries: 1. SELECT Name, Surname FROM People WHERE Surname = Smith NAME ...
20
2370
by: coosa | last post by:
Dear all, I have illustared with code and sample output data my request in thsi post. I simply was expecting some results from my search "amd socket a 32 bit cache 512 dell" that includes a logical...
4
2618
by: news.online.no | last post by:
In a query, I need too be able to show if a parent record has a child record. Using the query in a combo box too select record in a form. Thanks :)
1
2974
by: snOOp | last post by:
I am trying to combine the data from two similar tables into one query, but I need for all of the records from both tables to show up and I want the ones that have matching 'emplid' to be combined...
2
2724
by: Lyn | last post by:
Hi, How do you bind the output columns from a UNION query when the fields from the two tables have different names? Consider this query (WHERE clauses omitted)... SELECT SurnameBirth,...
2
2237
by: carl.barrett | last post by:
Hi, I'm back with the same question as I still can't get it to display my data the way I want it to. The table lists information about a perpetrator involved with an anti social behaviour...
7
1682
by: vivekian | last post by:
Hi , I need to place the results of two different queries in the same result table parallel to each other. So if the result of the first query is 1 12 2 34 3 45
1
4263
by: catudalg | last post by:
Configuration: Windows 2000 sp3 MS Access 2000 (9.0.4402 SR-1) Visual Foxpro 9.0 detached tables MS VFP Driver 6.01.6830.01 06/19/2003 For example, a simple query like: select * from ddwg1...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.