473,394 Members | 1,709 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,394 software developers and data experts.

Error As Variable Not Define

Dear sir,

I want to create a query at runtime and assigning value to them through a sql query.what is the error here. error is shown over variable qdf declaration
Expand|Select|Wrap|Line Numbers
  1. Dim QDF As QUERYDEF
  2. 'On Error Resume Next
  3. DoCmd.DeleteObject acQuery, "databaseQuery"
  4. 'On Error GoTo 0
  5. Set QDF = CurrentDb.CreateQueryDef("databaseQuery", ssqltext)
  6. '
  7. 'Export it to Excel
  8. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "databaseQuery", "C:\MyExcelData.xls"
  9.  
  10. 'Export it to Text
  11. 'DoCmd.TransferText acExportDelim, , "databaseQuery", "C:\MyData.txt"
Jan 30 '07 #1
3 2930
ADezii
8,834 Expert 8TB
Dear sir,

I want to create a query at runtime and assigning value to them through a sql query.what is the error here. error is shown over variable qdf declaration

Dim QDF As QUERYDEF

'On Error Resume Next
DoCmd.DeleteObject acQuery, "databaseQuery"
'On Error GoTo 0
Set QDF = CurrentDb.CreateQueryDef("databaseQuery", ssqltext)
'
'Export it to Excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "databaseQuery", "C:\MyExcelData.xls"

'Export it to Text
'DoCmd.TransferText acExportDelim, , "databaseQuery", "C:\MyData.txt"
This is the simplest Syntax for creating a Query. Your problem nust reside in the SQL Parameter, namely, ssqltext since the Error occurs on the SET QDF.. line. Please post it for our preview.
Expand|Select|Wrap|Line Numbers
  1. Dim MySQL As String, MyQDF As QueryDef, MyDB As DAO.Database
  2.  
  3. MySQL = "SELECT * FROM tblEmployee"
  4.  
  5. Set MyDB = CurrentDb()
  6.  
  7. Set MyQDF = MyDB.CreateQueryDef("Database Query", MySQL)
Jan 30 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Where have you declared and set the value of the variable 'ssqltext'?

Mary
Jan 31 '07 #3
Where have you declared and set the value of the variable 'ssqltext'?

Mary
Thankx for ur response error has been detected it was dao connection library was not defined which has been defined my using tool menu -reference-dao3.6

Thankx and regards
mukesh
Jan 31 '07 #4

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
3
by: Victor | last post by:
I'm trying to run this java program, but somehow the program always quit w/o giving any error msg at all. it happenned inside the first case statements. Strangely, after printing happen2, it just...
1
by: DiskMan | last post by:
System: Redhat 7.2 Kernel-2.6.11.8 GCC-3.4.3 CCC-6.5.9 Binutils-2.15 Make-3.80 GTK/GLIB-2.6.7 For some reason my Linux box is suddenly having issues trying to read ;
17
by: Steve Jorgensen | last post by:
If you've ever employed custom error numbers and messages in you programs, you've probably ended up with code similar to what I've ended up with in the past something like... <code> public...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
4
by: Gary | last post by:
Hi, I get this error " " when my web page run, what does it mean? Hope someone can help!!! Gary
11
by: Andrew Poelstra | last post by:
I hammered this out this morning to fix inconsistancies with the way my programs handle errors. The code itself is fine, in that it compiles with Richard Heathfield's gcc tags (plus -c because it...
2
by: akmkat | last post by:
When I try to compile the following code with N = 1024, "General Protection Exception" occurs, but wehn N < 20, there is no problem. I need N = 1024, what'll I do? Plz help anyone #include...
12
by: user923005 | last post by:
On Apr 11, 6:06 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrote: prog output.txt But I guess when you look at the data eventually, the global variable will rear its ugly head. After...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
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...
0
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...
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
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...
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...

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.