473,386 Members | 1,652 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,386 software developers and data experts.

vb code to access database - help reqd.

2
Hi,

Some time ago a friend's friend showed me a sample project to access the tables in MS Access directly through vb code. I couldn't see any ADO control on any of the forms. The ActiveX Objects library was however included in the project references.
I tried to do the same thing on my own with a trial project using the Northwind database, but failed. I get the following error messages: connection is closed or the object is not found or method not found.

I included the following statements like him in the project.

Under General declarations:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Public conXYZ as ADODB connection
  3.  
  4. Under Formload:
  5.  
  6. Private Sub Form_Load()
  7.  
  8. Set conXYZ = New Connection
  9.     conXYZ.CursorLocation = adUseClient
  10.  
  11.  
  12.     conXYZ.Open "Driver={Microsoft Access Driver(*.mdb)};DBQ=C:\Test.mdb;UID=admin;PWD=testdb;"
  13. End Sub
  14.  
  15.  
  16. where test.mdb is a copy I made of of the northwind database.
  17. Unfortunately I have lost touch with the guy. Can any one help?
Apr 3 '08 #1
2 1170
Dököll
2,364 Expert 2GB
Hi,

Some time ago a friend's friend showed me a sample project to access the tables in MS Access directly through vb code. I couldn't see any ADO control on any of the forms. The ActiveX Objects library was however included in the project references.
I tried to do the same thing on my own with a trial project using the Northwind database, but failed. I get the following error messages: connection is closed or the object is not found or method not found.

I included the following statements like him in the project.

Under General declarations:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Public conXYZ as ADODB connection
  3.  
  4. Under Formload:
  5.  
  6. Private Sub Form_Load()
  7.  
  8. Set conXYZ = New Connection
  9.     conXYZ.CursorLocation = adUseClient
  10.  
  11.  
  12.     conXYZ.Open "Driver={Microsoft Access Driver(*.mdb)};DBQ=C:\Test.mdb;UID=admin;PWD=testdb;"
  13. End Sub
  14.  
  15.  
  16. where test.mdb is a copy I made of of the northwind database.
  17. Unfortunately I have lost touch with the guy. Can any one help?
You have the markings of s skilled programmer, if this is your code. I actually have no clue. I must say though I have just posted a code in DAO I think might be helpful:

http://bytes.com/forum/thread790879.html

Dököll
Apr 4 '08 #2
BalaC
2
What does the highlighted word 'subscribed' at the bottom of the posting mean? -Bala
Apr 7 '08 #3

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

Similar topics

1
by: Pragati | last post by:
Hi ! I have an SQL query which im developing on the click of a command button on a form. but am stuck up in creating a recordset of that query. how should one connect to database? use adodb...
5
by: Chand | last post by:
Private Sub tbDate_AfterUpdate() Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset rst.CursorLocation = adUseClient Set cnn = CurrentProject.Connection rst.Open "SELECT * FROM...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
6
by: Daren Hawes | last post by:
Hi, My web host has a low security setting on the shared .net server I use. I cannot use third party dll's or install assemblies in the GAC. All I need to do is verify that a FTP login is...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
1
by: tulikapuri | last post by:
Hi Friends, I am new to Access DB and i am trying to put a DB for a Foundry Lab, I am willing to generate one single report from multiple tables but i am really confused how should i really do...
0
by: peridian | last post by:
Hi, I have the below code to transfer code modules between Access database files. I have three problems, only one of which is annoying. a) How do you prevent the Save As box from appearing...
3
by: altafur | last post by:
hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query: SELECT distinct...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.