473,405 Members | 2,294 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,405 software developers and data experts.

First attempt at ADO a dismal failure

Hi hope someone can help

I'm trying to use ADO in access to lookup product info from a few tables. The table to use depends on the choices the user selects in three combo boxes. I just can't get it to connect to any of the tables with my code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub PopulateGrade()
  2.     Dim cnn1 As ADODB.Connection
  3.     Dim GdRs As New ADODB.Connection
  4.     Dim SQLst As String
  5.  
  6.     Set cnn1 = CurrentProject.Connection
  7.  
  8.     SQLst = "SELECT Product, Flute FROM "
  9.     SQLst = SQLst & ComboMill.Value & ComboBoard.Value
  10.     SQLst = SQLst & " WHERE (((Flute)='"
  11.     SQLst = SQLst & ComboFlute.Value & "'"
  12.  
  13.  
  14.     GdRs.Open SQLst
  15. End sub
  16.  
ComboMill, ComboBoard and ComboFlute's row source type are set to value list and contain the suppliers names, general material type and material thickness. Combining ComboMill and ComboBoard gives the table name (or should).

When I run the code I get:

Run-Time Error '-2147467259(80004005)':

[Microsoft][ODBC Driver Manager]Data source name not found and no default driver specified.

I need to know if it's looking for the data source in the right place as the name should be correct and what's a default driver and how do you specify one.

Any help you can offer is most welcome as this is driving me nutts

Many thanks
Dave
Nov 12 '07 #1
2 1129
Rabbit
12,516 Expert Mod 8TB
Please use code tags.

Have the code either MsgBox or Debug.Print the SQL string before trying to execute it. See if it's at least returning what it should be.

Your SQL string has too many unclosed parentheses.
Nov 13 '07 #2
FishVal
2,653 Expert 2GB
Hi, Dave.

To open connection you need to use connection string, not SQL statement which is used to open recordset or run command on opened connection.
To see what is JetOLEDB connection string looks like go to VBA immediate window and run:

? CurrentProject.Connection

many of the string arguments are in most cases optional, but the following two you need to provide
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=X:\.....\db1.mdb"

BTW, if you want to access datasets in current database you should use that opened and ready to use connection.

Regards,
Fish
Nov 13 '07 #3

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

Similar topics

2
by: Richard Lewis Haggard | last post by:
I know this is a really simple thing but it is not intuitively obvious on how to do this the first time. I've created a remote server which lives in an EXE. This compiles. I've create a client...
16
by: Martin Joergensen | last post by:
Hi, I wanted to try something which I think is a very good exercise... I read in data from the keyboard and store them in a structure. There's a pointer called "data_pointer" which I use to...
7
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into...
7
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into...
3
by: cs | last post by:
Hi, I'm new to C and would appreciate any feedback on the following program, asplit, which splits a file into 2 new files, putting a certain number of lines in the first file, and all the rest...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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,...
0
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...
0
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...

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.