473,405 Members | 2,261 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.

Creating Recordset Clone

675 512MB
I want to create a RecordsetClone. MS Access Help has an example under "Clone Method Example (MDB)" which has the statement " Dim dbs As Database".
I need clones in several modules, so in a global module I tried "Global dbs As Database"

Seems to me to be similar enough to the example from MS, but I get the message "User-defined type not defined". Changing to "Dim dbs as Database" gets the same error.

I'm not trying to define my own type, only use one defined already by Microsoft.

What am I doing wrong?

OldBirdman
Nov 16 '07 #1
3 3854
puppydogbuddy
1,923 Expert 1GB
I want to create a RecordsetClone. MS Access Help has an example under "Clone Method Example (MDB)" which has the statement " Dim dbs As Database".
I need clones in several modules, so in a global module I tried "Global dbs As Database"

Seems to me to be similar enough to the example from MS, but I get the message "User-defined type not defined". Changing to "Dim dbs as Database" gets the same error.

I'm not trying to define my own type, only use one defined already by Microsoft.

What am I doing wrong?

OldBirdman
Try :
Global dbs As DAO.Database
Dim dbs DAO.Database
Nov 17 '07 #2
ADezii
8,834 Expert 8TB
I want to create a RecordsetClone. MS Access Help has an example under "Clone Method Example (MDB)" which has the statement " Dim dbs As Database".
I need clones in several modules, so in a global module I tried "Global dbs As Database"

Seems to me to be similar enough to the example from MS, but I get the message "User-defined type not defined". Changing to "Dim dbs as Database" gets the same error.

I'm not trying to define my own type, only use one defined already by Microsoft.

What am I doing wrong?

OldBirdman
  1. To Declare a 'Global' Recordset Object Variable that can be accessed anywhere from within your Application, use the Public Keyword along with the Explicit Library Type as in:
    Expand|Select|Wrap|Line Numbers
    1. Public rstMain As DAO.Recordset
    2. Public rstMain As ADODB.Recordset
    3.  
  2. You seem to indicate that you will be using 1 'Global' Variable to Reference multiple Clones in your code. This could be a very bad idea depending on your overall logic and is one of the inherent dangers of Globals. If you use a Global Object Variable to refer to a 2nd Clone, the original Reference will be lost.
Nov 17 '07 #3
OldBirdman
675 512MB
Thanks both for your replies.

I was NOT trying to create global clones or recordsets, but only a global Database. I thought that my project was a database, so having one reference to it would simplify things. Apparently it doesn't.

I do not understand DAO vs. MDB. Past experience has taught me to use MDB and avoid DAO. Things then work [better]. However, PLEASE do not get into a discussion about that now.

OldBirdman
Nov 17 '07 #4

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

Similar topics

0
by: Dan Perlman | last post by:
From: "Dan Perlman" <dan@dpci.NOSPAM.us> Subject: ODBC creating nulls? Date: Friday, July 09, 2004 10:43 AM Hi, Below is my VB6 code that writes data from an Access 2000 table to a PG table....
20
by: svend | last post by:
I'm messing with some code here... Lets say I have this array: a1 = ; And I apply slice(0) on it, to create a copy: a2 = a1.slice(0); But this isn't a true copy. If I go a1 = 42, and then...
3
by: Tlm | last post by:
Hello All, I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also has a subform embedded in it (SubFrmC) The form's recordsource is based on a table (TblA). SubFrmB's...
2
by: Robin S. | last post by:
This is an "Add product" form. The user will enter a ProductNo (catalog number), select a Product Class (from cascading combo boxes) and then click a button to create the product. When a...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
6
by: RSH | last post by:
Hi, i have a situation where I need to dynamically create objects in a loop. My question surrounds intantiation naming in such a scenerio. Below is a snippet that is basically hardcoding each...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
15
by: mark.norgate | last post by:
Hello I want to create a reference to an object, so that changes to the referenced object are reflected in the other object. Like this: object o = 123; object p = o; o = 456;
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.