473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a database connection and recordset

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 or dao connection? are
there any particular setting reqd in vb editor?
what will be the syntax for connecting to a databse?
what shud be the syntax for opening my query in a recordset?

if i say
dim db as dao.database
dim rs as adodb.recordset
or
dim db as adodb.database
dim rs as adodb.recordset
i get an error message saying "object not defined" ???

also ... can i pass a recordset variable to another form or report?
can a recordset created in one form be accessed in some other
form/report?

please help. this is kind a urgent... !
thanks in advance
pragati
Nov 12 '05 #1
1 2818
If you use a DAO database object, you need to use a DAO Recordset. If you
want to use an ADO Recordset, you must use an ADO Connection. ADO does not
have a "Database" object.

On 29 Dec 2003 00:58:43 -0800, pr**********@ya hoo.com (Pragati) wrote:
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 or dao connection? are
there any particular setting reqd in vb editor?
what will be the syntax for connecting to a databse?
what shud be the syntax for opening my query in a recordset?

if i say
dim db as dao.database
dim rs as adodb.recordset
or
dim db as adodb.database
dim rs as adodb.recordset
i get an error message saying "object not defined" ???

also ... can i pass a recordset variable to another form or report?
can a recordset created in one form be accessed in some other
form/report?

please help. this is kind a urgent... !
thanks in advance
pragati


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2113
by: BP | last post by:
I get the following error: Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '' /myweb4/authorised_user_page.asp, line 70 and line 70 of my code is: <% rsCheckUser1.Open strSQL1, strcon1 %> Here is the full code:
0
2581
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone. I discovered this the other day while doing some experiments with ADO and ADO.NET. Basically, I wanted to run a stored MS Access query with parameters using the syntax Execute MyProcedure @Param1, @Param2...
2
4445
by: Jozef | last post by:
Hello, I'm trying to create a central function that runs a connection to an SQL Server database. The connection etc works, but when I try to call it, I get an error saying "Runtime-Error 91: Object variable or with block variable not set". I have pasted the code below. The first section is the function that I'm using, the second function is only the test that calls teh genErrorColl function '***************** Start Code...
44
4573
by: Greg Strong | last post by:
Hello All, Is it better to create a query in DAO where a report has 4 sub-reports each of whose record source is a query created at runtime and everything is in 1 MDB file? From what I've read and experienced it appears DAO is the way to go in this situation, so when is it good to use ADOX to create queries? Why do I ask the question? I've created a MDB file which uses DAO, but
1
4734
by: dave | last post by:
I'm classic ASP developer and trying to switch to .net ...I'm newbie to ..net... In classic ASP for ADO connectivity i used to put below code in one separate file and used to include that file whereever I need database opreation... Dim objDatabase Set objDatabase = Nothing '-- Singleton for the CDatabase class Function Database If objDatabase Is Nothing Then Set objDatabase = New CDatabase End If
3
2661
by: Bhavsan | last post by:
Here is what I am trying to do. Kindly, help me. 1. I'm creating a query dynamically based on User input using VBA (strSQL and DotSQL in the code below) 2. Executing the created query with in VBA 3. Writing to a table (tblRandom) the values from the recordset. -------------------------------- Private Sub append_record_Click() Dim strSQL As String Dim dotsql As String
3
2259
by: emajka21 | last post by:
Hello, and thank you in advance for trying to help me. I am trying to create an access 2000 form without using the wizard. It just doesn't seem like I can the level of complexity I want out of the wizard so I want to hand code the form. If this was any other language accessing an access form I know how to do it but I am not sure how to access the tables WITHIN the access database itself. Here is what I would like the form to do. On Load:...
3
1655
by: Ninio | last post by:
i would like to know how to query a database so that if a category from the dropdown menu is selected it will display all the records found on the table. thank you very much. Here is the table from the database: Description Design Type Price Necklace Spiral 18 ct Gold £1,725.99 Necklace Chain 9 ct Gold £150.75 Ring Sapphire 18 ct Gold £975.00 Necklace Loop 9 ct Gold £199.50 Ring Opal 18 ct Gold £225.50
3
2267
by: smugcool | last post by:
Hi, I have created a form in Visual basic 6.0 for adding/updating the change request made by various users. Well i am able to update the record through my code in access database. Can anyone tell me what code should i use to Add record in the database, i also want the new record which will be added in the access database is having some unique no like CRC-CC-date/month/year-incremental number? I mean as soon anyone will hit the add...
0
9645
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
9481
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
10336
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
10155
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
10095
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,...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
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();...
1
4054
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
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.