473,662 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate Access 2000 combo box with SQL data using VBA

1 New Member
Using MSAccess 2000. I have the frm_start combo box unbound and cmbWCoilNo Row Source Type set to Value List. The following code populates the variable strCombo with some values but gives me an error of: "The setting for this property is too long" Any ways around this, or any other possible ideas ? Have also tried .AddItem but this does not seem to work in Access 2000. I am trying to populate the combo box with 600 Primary Key values of 4 digits each. Thanks for looking.

Private Sub Form_Open(Cance l As Integer)
Dim CN As ADODB.Connectio n: Dim rs As ADODB.Recordset
stDocName = "frm_start" : DoCmd.OpenForm stDocName, , , stLinkCriteria: DoCmd.Maximize

SQLb = "SELECT Coil FROM CoilSpec.dbo.co ilspec"
Set CN = New ADODB.Connectio n: CN.Open "driver={SQ L Server};" & _
"server=172.16. 6.172;database= CoilSpec;uid=dt uttle;password= mpmadmin"
Set rs = CN.Execute(SQLb , , adCmdText)

Me.cmbWCoilNo.R owSource = ""
Dim strCombo
strCombo = ""

While Not rs.EOF
strCombo = strCombo + rs.Fields("Coil ") & ";"
rs.MoveNext
Wend
Me!cmbWCoilNo.R owSource = strCombo

rs.Close: CN.Close: Set rs = Nothing: Set CN = Nothing

End Sub
Sep 13 '06 #1
1 7186
PEB
1,418 Recognized Expert Top Contributor
Hi,

Why do not try to connect the combo box directly to your source table instaed to put the values one by one cycling on the recordset?

Have a nice day!

:)
Sep 14 '06 #2

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

Similar topics

5
3311
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in Access 2003 (as an Access 2000 db). Details follow... I have an unbound combo box on my main form...
1
2792
by: Del | last post by:
We have a MS SQL Server 2000 application for our shipping system. We have created a front end application using MS Access for our order analyst. The front end application allows the analyst to review and update orders before they are released to the warehouse. We are in the test phase of this project and have run into a couple problems that we just can not figure out. During the testing phase there is only one person working in the...
1
2035
by: Cindi | last post by:
Hi, Another newbie with a question that I hope someone can point me in the right direction. The goal is to populate a text box with data according to the selection in a combo box while still being able to navigate the records one by one. The combo box record source is a table/query asking for the ID, Subj, Title, CourseGoals from one table and displays Column 1. I've set up the text box
4
2999
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be added to the data grid. My current code is coming up with errors, dt and drv are unknown in the else part of the if statement. if (this.dgPrivileges.DataSource == null) {
2
4228
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with this. Also - the citrix folks do not want us to keep the FE in Access as the queries and other activities consume a lot of power. The users will be in 3 different offices across the globe all accessing the 1 Oracle DB in Citrix. Does anyone have...
29
3836
by: gedwards | last post by:
First off, I am a complete newbie to Access. I've used it maybe a half dozen times, all my database knowledge is with Oracle. I'm building a database/form in Access 2003. I'm trying to get it so that I can select a Location from one combo box, and a date from another combo box, and have a Subform populate with the correct data for each date/location selected. I'm not really sure how to go about this, but I've been reading maybe using a...
3
11271
by: David | last post by:
I am trying to use Dlookup to populate a text box on a form, but haven't had any good luck so far. I've looked here at the posts and have used the Access help for examples. Northwind is way over my head. I think that I'm coming up short in the Criteria part of the function. I have a combo box that looks to the 'Student' table, 'Student_ID' field to list the students, and then places the selected value in the 'Student_ID' text box on...
4
13953
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt tbl_Input has three fields: OSE_Job, OSE_Name, OSE_Wt I have populated tbl_OSE_Info table. I need to create a form that will store the data in tbl_Input I have racked my brain so much trying to figure out how to auto populate a field based on a...
5
3997
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make Fields Names: countrycode, make
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
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 we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.