how?
i need get some data from table, at the action
i try anything DAO and ADO, it doesn't works((
for example, this code -
Dim WorkBase as Database
-
Dim WorkRS1 as Recordset
-
Dim SQL as String
-
-
Set WorkBase = OpenDataBase(“voyages.mdb”)
-
-
SQL = “Select init from Managers WHERE contact=” & manager
-
Set WorkRS1 = WorkBase.OpenRecordset(SQL)
-
-
WorkRS1.Close
-
WorkBase.Close
-
it returns error at the first line Dim WorkBase as Database
"User-defined type not defined"
what's wrong?
help me pls
6 2375
how?
i need get some data from table, at the action
i try anything DAO and ADO, it doesn't works((
for example, this code -
Dim WorkBase as Database
-
Dim WorkRS1 as Recordset
-
Dim SQL as String
-
-
Set WorkBase = OpenDataBase(“voyages.mdb”)
-
-
SQL = “Select init from Managers WHERE contact=” & manager
-
Set WorkRS1 = WorkBase.OpenRecordset(SQL)
-
-
WorkRS1.Close
-
WorkBase.Close
-
it returns error at the first line Dim WorkBase as Database
"User-defined type not defined"
what's wrong?
help me pls
In the VBA Editor check Tools - References. Make sure there is a DAO library ticked on the list.
Mary
i turn on it,
now, other error at line
Set WorkRS1 = WorkBase.OpenRecordset(SQL)
"Runtime error 13, Type Mismatch"
If manager is a control on your form and a text data type, try ... -
SQL = "Select init from Managers WHERE contact='" & manager & "'"
Mary
how?
i need get some data from table, at the action
i try anything DAO and ADO, it doesn't works((
for example, this code -
Dim WorkBase as Database
-
Dim WorkRS1 as Recordset
-
Dim SQL as String
-
-
Set WorkBase = OpenDataBase(“voyages.mdb”)
-
-
SQL = “Select init from Managers WHERE contact=” & manager
-
Set WorkRS1 = WorkBase.OpenRecordset(SQL)
-
-
WorkRS1.Close
-
WorkBase.Close
-
it returns error at the first line Dim WorkBase as Database
"User-defined type not defined"
what's wrong?
help me pls
Here is workable code that Opens an External Database (C:\Test\Test.mdb), creates a Recordset based on a simple SQL Statement, then loops through all Records in the Recordset outputting the First and Last Name Fields to the Immediate Window. - Dim MyDB As DAO.Database, MyWks As DAO.Workspace
-
Dim MyRS As DAO.Recordset, strSQL As String
-
-
strSQL = "SELECT * FROM tblEmployee;"
-
-
Set MyWks = CreateWorkspace("", "admin", "", dbUseJet)
-
Set MyDB = MyWks.OpenDatabase("C:\Test\Test.mdb", True) 'Open Exclusive
-
Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
-
-
Do While Not MyRS.EOF
-
Debug.Print MyRS![FirstName] & " " & MyRS![LastName]
-
MyRS.MoveNext
-
Loop
-
-
MyRS.Close
-
MyDB.Close
-
MyWks.Close
- Dim MyDB As DAO.Database, MyWks As DAO.Workspace
-
Dim MyRS As DAO.Recordset, strSQL As String
-
-
strSQL = "SELECT * FROM tblEmployee;"
-
-
Set MyWks = CreateWorkspace("", "admin", "", dbUseJet)
-
Set MyDB = MyWks.OpenDatabase("C:\Test\Test.mdb", True) 'Open Exclusive
-
Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
-
-
Do While Not MyRS.EOF
-
Debug.Print MyRS![FirstName] & " " & MyRS![LastName]
-
MyRS.MoveNext
-
Loop
-
-
MyRS.Close
-
MyDB.Close
-
MyWks.Close
thanks, this code is works.
i think the reason of error was at the dbOpenDynaset key. i don't assign it to function befor
thanks, this code is works.
i think the reason of error was at the dbOpenDynaset key. i don't assign it to function befor
The reason why it didn't work before was probably because this line was omitted from the code. You must create a Workspace Object to open a Database within: - Set MyWks = CreateWorkspace("", "admin", "", dbUseJet)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: unixman |
last post by:
As usual, it is 2:00am, and I'm pulling my hair out, finally resorting to
posting in the newsgroups for help. :)
Simple problem, in theory.
Given table "map":
CREATE TABLE map (
entry_id...
|
by: Eddie Smit |
last post by:
field- field-
surname town
---- ----
john NY
john Vegas
john Boston
eddie Boston
eddie New Orleans
eddie NY
|
by: Nicolae Fieraru |
last post by:
I have two tables, they contain:
Table1: ID1, Name1, Address1, Purchase1
Table2: ID2, Name2, Address2, Purchase2
I need a query which creates Table3 with content from Table1 and Table2.
The...
|
by: rednexgfx_k |
last post by:
All,
Problem Summary: I've running about 30 make table queries via VBA in
Access 2000, and my database goes from 14,000k to over 2,000,000k. In
addition, the longer the procedure runs, the...
|
by: Bob Alston |
last post by:
Anyone know a way to make all access to a linked table, in another
Access MDB, read only?
I really don't want all the hassle of implementing full access security.
I can't do this at the server...
|
by: John Baker |
last post by:
Hi:7
Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool
looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have
named HireInput,...
|
by: Ivan Marsh |
last post by:
Hey Folks,
I'm having a heck of a time wrapping mind around AJAX.
Anyone know of a simple, straight-forward example for pulling a simple
query from mysql with PHP using AJAX?
As I...
|
by: MLH |
last post by:
How can I turn the following into a make-table query?
SELECT & " " & AS Recipient FROM
tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID
= tblAddnlOwnrs.VehicleJobID WHERE...
|
by: lsllcm |
last post by:
Hi All,
I have one question about many "or" operation make system choose
incorrect index
There is one table TT (
C1 VARCHAR(15) NOT NULL,
C2 VARCHAR(15) NOT NULL,
C3 VARCHAR(15) NOT NULL,...
|
by: Ken Fine |
last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets
and DataTables should be able to answer fairly easily. The basic question is
how I can efficiently match data from one...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
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...
|
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...
|
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: 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...
|
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...
| |