473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Combo Box connected to Database

43
Hello everyone..im having problem in connecting my Combo Box to my database.
What i want to do is to place all entries of one column in my Db to combo box.
Like this...I want to place all entries in the Column <customer_name> of my <customer> table of my DB in my combo box. i really need this code badly.

Thanks in advance....
Nov 6 '07 #1
6 5857
QVeen72
1,445 Expert 1GB
Hi,

Use DBCombo or DBListBox, Set the following properties:

DataSource, DataField, RowSource, RowMember

Regards
Veena
Nov 6 '07 #2
daveftl
43
Hi,

Use DBCombo or DBListBox, Set the following properties:

DataSource, DataField, RowSource, RowMember

Regards
Veena
there is a MsgBox saying "no compatible data source was found for this control" when i cliked the rowSource property of DBCombo...im using MySQL as my database
Nov 6 '07 #3
debasisdas
8,127 Expert 4TB
Try this piece of sample code.
Expand|Select|Wrap|Line Numbers
  1. CboName.Clear
  2. SQLName = "SELECT NAME FROM ENGINEER"
  3. Rs.Open SQLName, Con, adOpenDynamic, adLockOptimistic
  4.  
  5. Set CboName.DataSource = Rs
  6. For i = 0 To Rs.RecordCount - 1
  7. CboName.AddItem Rs(0)
  8. Rs.MoveNext
  9. Next i
  10. Rs.Close
  11.  
Hope that solves your problem.
Nov 6 '07 #4
daveftl
43
Try this piece of sample code.
Expand|Select|Wrap|Line Numbers
  1. CboName.Clear
  2. SQLName = "SELECT NAME FROM ENGINEER"
  3. Rs.Open SQLName, Con, adOpenDynamic, adLockOptimistic
  4.  
  5. Set CboName.DataSource = Rs
  6. For i = 0 To Rs.RecordCount - 1
  7. CboName.AddItem Rs(0)
  8. Rs.MoveNext
  9. Next i
  10. Rs.Close
  11.  
Hope that solves your problem.
there is an error in the line : Set CboName.DataSource = Rs
error : ' cant bind the data source
Nov 6 '07 #5
QVeen72
1,445 Expert 1GB
Hi,

Add a ADODC datacontrol to your Form, and set these Properties:
Right Click ADODC1 and goto ADODC properties:
"Use Connection String" and Build.. Test the Connection.
Goto Record Source and Type the Select statement , say

Select FldName From TableName

and say OK.
Now Go to properties of DBCombo, and RowSource = ADODC1
ListField = FldName

And Run the form, it should work..

Regards
Veena
Nov 7 '07 #6
daveftl
43
Hi,

Add a ADODC datacontrol to your Form, and set these Properties:
Right Click ADODC1 and goto ADODC properties:
"Use Connection String" and Build.. Test the Connection.
Goto Record Source and Type the Select statement , say

Select FldName From TableName

and say OK.
Now Go to properties of DBCombo, and RowSource = ADODC1
ListField = FldName

And Run the form, it should work..

Regards
Veena
thanks...

i did try this code and it worked as well..


Private Sub fillList()

Do While Not rsBot.EOF

cmboBotNo.AddItem rsBot(0) ' rsbot is a recordset
rsBot.movenext

Loop

End Sub
Nov 8 '07 #7

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

Similar topics

3
by: Bobbak | last post by:
Hello All, I was wondering if it is at all possible to have a single combo box update multiple fields in a single record. For example I have created an Employee Info form, and in that form there's...
1
by: Bobbak | last post by:
Hello All, I am having trouble with this forum I am developing in Access; I have two combo boxes, one containing the Director info, and the other containing the Manager info. Now what I want to...
1
by: Jim Stacey | last post by:
In my form based on the table Customers i have a combo box looking up for the employees. The tables Employees and Customers are related in one to many relationship, the primary key Employeeid in...
3
by: J. Thompson | last post by:
I have an Access application linked to a SQL Server 2000 database using ODBC. Call this database/server pair DB1 Part of the app needs to link to another local 2000 server to get data from...
2
by: Jacques | last post by:
Hi , I've 24 Combo Box in a Group , connected to the same DataSource (ArrayList) : easy way to fill Combo . The pb i've , is that when i select an item in 1 combo then all other 23 will...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
6
vikas1111
by: vikas1111 | last post by:
I have connected combo box to database and the first content of the column is displayed.. I want to display all the contents of the column in combo box .. How can i do that ?
2
by: prokopis | last post by:
am using c# for windows application and i need some help. i have a combo box that is connected with the database and retreive the data from a table in the database.this tha i need is if is possible...
13
by: premMS143 | last post by:
Hi Everybody, I'm using VB to create a stand alone application. I want to delete some data item from Combo box & List Box. I've done this. When I try to delete any data item from the combo or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.