473,473 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Open and save query with code

Hello everyone. I have a table linked to an excel spreadsheet. I have
an append query based on this link table. I receive an error when I
run the append query "numeric field overflow". I have noticed that
when I open then save the append query and then run it I get no error.
I am assuming that the error is being caused by Access Optimizing. The
easy solution to my problem is if it is possible to run some VB code
that will save my append query before I run my append query.

Is there a way With code to open and save a query? Thanks

Nov 13 '06 #1
1 1818

eighthman11,

If I'm interpreting your question correctly, yes there is an easy way
to create and save a query with code.

Public Sub CreateQuery (strName as String, strSQL as String)
Dim dbs as Database
Dim qdf as Querydef

Set dbs = CurrentDb
Set qdf = dbs.CreateQueryDef(strName, strSQL)

Set qdf = Nothing
Set dbs = Nothing

End Sub

Of course for this to work you need to be able to write a SQL statement
that fits your needs. As a side note, the above is accomplished through
DAO, most advanced developers use ADO as their preferred alternative.
However, if you are working solely through Access/VBA, then DAO is
quite sufficient.

Kelii

Nov 14 '06 #2

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

Similar topics

2
by: Bryan Feeney | last post by:
I'm working on a site which dynamically generates tables of rates in CSV format. The script which does the work is called generate_stats.php. Here's the header header ("Content-type:...
3
by: Newbie | last post by:
I am trying to get the save/open dialog figured out. I am able open the save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below...
4
by: Tom Sapp | last post by:
I was wondering what the easiest way to get only the filename from the FileName property of the Save/Open dialogs in Visual C++? I've create a string variable and set it to SaveDialog1.FileName but...
15
by: dixie | last post by:
I have a command to open the Access Options dialogue from code: DoCmd.RunCommand acCmdOptions It also opens the Database Window behind it. Is it possible to open the Options without having...
9
by: Mike Bridge | last post by:
I am using MS Access 2003, and I typed in a query in SQL view which was working fine. Now when I open it, it gives me the error "Join expression not supported". Apparently, Access "fixed" it for...
4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
4
by: Bishman | last post by:
Hi, Can someone suggest the best technique / method of opening a Word ( or any other ) Document from an SQL BLOB ? I have the process of saving and retrieveing the file from an SQL Binary...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
0
by: Ang | last post by:
Hi, I want to open a word file on background instead of showing the process on client's screen. And then do mailmerge, after that allow user to saveas. (user simply click the button and IE will...
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
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.