473,796 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run a query that exists in Access from VB

I tried Googling this but I get a whole lot of replies about running
the SQL statement in VB via ADO.

All I want to do is run an existing ACCESS 2000 query from VB with no
information returned to VB. I am presuming that I would use
Automation somehow.

Thanks in advance.
Nov 13 '05
12 34839
On Mon, 11 Jul 2005 22:59:59 GMT, New Guy <Ne****@yahoo.c om> wrote:

Is ADO preferable to the Acess.Applicati on method below. Just for my
education, can you tell me why ADO is better?


Hi
I suggested several reasons in my last post. ADO will also be a lot
quicker. You would only use the automation method if you wanted to do
access-specific things like run a report as opposed to just using the
data.
If you hadn't been so rude to pietlinden you might have found this out
earlier.

David

Nov 13 '05 #11
On Mon, 11 Jul 2005 22:59:59 GMT, New Guy <Ne****@yahoo.c om> wrote:

¤ On Mon, 11 Jul 2005 08:29:57 -0500, Paul Clement
¤ <Us************ ***********@sws pectrum.com> wrote:
¤

¤ I see. A query existing in ACCESS is a stored procedure.?
¤

It's about as close as you can get in Access.

¤ Does this return an error message if the statement fails?
¤

Yes, a run time error is generated if the statement fails to execute so you should have error
handling code to take care of it.

¤ Is ADO preferable to the Acess.Applicati on method below. Just for my
¤ education, can you tell me why ADO is better?
¤ Dim objAccess As Access.Applicat ion
¤ Set objAccess = New Access.Applicat ion
¤ 'MsgBox objAccess.Repor ts.Count
¤
¤ objAccess.OpenC urrentDatabase "C:\Current Database\new.md b"
¤ objAccess.Visib le = True
¤ objAccess.DoCmd .OpenQuery ("Create_Invoic e_Footer")
¤ objAccess.Run ("Create_Invoic e_Footer")

ADO is preferable to Access automation. First, ADO is more efficient and second if you use Access
automation then the Access application must be installed to run the code.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 13 '05 #12
am i missing something or could you just use
DoCmd.OpenQuery "qryYourQueryNa me"

Nov 13 '05 #13

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

Similar topics

5
4342
by: Jahmil Richardson | last post by:
Attempting to query MS Access database with the ODBC drivers for PHP. When using the LIKE statement no records are returned. Example: $query = " Select * From Dispatch Where Customer Like '*A*' "; $result = odbc_prepare($db,$query); odbc_execute($result); Does anyone out there know the syntax that I should be using for the Like
5
1575
by: meyvn77 | last post by:
I wrote a bunch of SQL statement in SQL SERVER and now im trying to do the same thing in access. OMG what a pain that Access can't handle updates or CAST() the way SQL server can. OK I thought I wrote everything in Ansi standard SQL statement so it should be compatable? right? The problem is i'm going from a relational format to a flat file fomat and this is only a 15th of the accual query. Please tell me their is a way to use this type...
0
2553
by: abhishekjethwani | last post by:
How to write a query to access tree structure form multi table. I m having five tables from them first table give me a data which act as the parameter for query for the second table and the two tables will give me parameter for the third and so on. at present i m writing five query and sending parameter to each query but i want an efficient way for this. its a parent child type relation.
2
3627
candicemc
by: candicemc | last post by:
Can anyone help me please?! I am a beginner and i am in desperate need of help. I have to create an insert query in access using a table i've already created called "madlibs" Then I have to create a code in vb.net to call this query when a user clicks the submit button. The objective is to have the database automatically updated when a user submits information. The problem is that I don't know where to begin, so if someone could just point me...
5
4966
by: Jim | last post by:
I'm a vb.net newbie. I have an query that is entirely within an Access database. It's a simple update query - "usp_Append_tbl_RefNos". It works in Access, How can I run that query from a vb .net program? I have an vb app that does update another Access table using a stored procedure but it updates fields with info from a file. I've tried the code below and I get an error on the ExecuteNonQuery() -
4
1911
by: ashutoshvyas | last post by:
I am designing a data report in VB6. In data environment it is possible to selet tables and 'select quries'. But I want to generate a report based on parameters passed by user, so i had created a parameter query in ACCESS which is not available in the properties of command1. SQL code of query is as under : SELECT Customers.account_no, Customers.card_no, Customers.name, payments.amount, payments.payment_date, dlt_3., total_amount. FROM...
1
2005
by: rune | last post by:
Hi I'm trying to convert an SQL Query from Access to SQL Server. The Access Query goes like this: SELECT Format(EntryDate, 'ddd mm dd') AS FROM JournalEntries This query returns the name of the day followed by month and date (Su aug 21)
9
2657
by: anthony | last post by:
In Access 2007, why does a query field designed as Term: ! ! return 00:00:00 when cboTerm actually contains 08SP. This works as expected in Access 2003?
0
1305
by: csin | last post by:
I have an Access DB backend for the application I am running, I want to use the built in ability in Access to remove duplicate entries... Say I have table1 with fields field1 field2 and field3, none of the fields are indexed without duplicates for a reason... The way I remove duplicates is to do an append query into an identical table that has one of the fields set to indexed no duplicates. If I run this query in Access directly I get a...
12
19865
by: jenniferhelen | last post by:
I am working with a query that has 6 columns and 101 rows; I would like to transpose the rows and columns. I have tried using a crosstab query but Access limits the row "fields" to 3 and this was not producing the desired output. I saw a comment in a thread about using a pseudo row field as a work around but I do not understand how this works. Another option I tried is from the following link and attempting method 2: ...
0
9535
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
10465
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...
1
10200
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,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
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
6800
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();...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.