473,503 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax error? parameter querydefs



Set qd = CurrentDb.QueryDefs("qsXX")
qd.Parameters("parDt") = "#9/1/2006#"
With Me.subFom.Form
.RecordSource = qd.SQL
.Requery
End With

in that case, parameter dialog box appear. why?
what's wrong?

*** Sent via Developersdex http://www.developersdex.com ***
Oct 19 '06 #1
1 2508
x taol wrote:
>
Set qd = CurrentDb.QueryDefs("qsXX")
qd.Parameters("parDt") = "#9/1/2006#"
With Me.subFom.Form
.RecordSource = qd.SQL
.Requery
End With

in that case, parameter dialog box appear. why?
what's wrong?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You've created an instance of the QueryDef and then set that instance's
parameter. Then you've taken only the QueryDef's SQL and put it into
the RecordSource of the form. That SQL still has the parameter line
("PARAMETERS parDT Date;") without the value because the QueryDef holds
the parameter value, not the SQL string.

You could just do a Replace() to get rid of the PARAMETERS line and
substitute the date value for the parameter name. E.g.:

strSQL = Replace(qd.SQL,"PARAMETERS parDt DateTime;","")
Me!subForm.Form.RecordSource = Replace(strSQL, "parDT","#9/1/2006#")

You don't have to Requery 'cuz changing the RecordSource automatically
does that.
--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRTgv9YechKqOuFEgEQL1xgCdEZ18+GOVRMGPpDdp/mkYIReOUfAAoINz
0ba04P5gsxehoruNSWh0O5bL
=DYMY
-----END PGP SIGNATURE-----
Oct 20 '06 #2

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

Similar topics

4
11342
by: Max Harvey | last post by:
Hi, I have looked at the example called "Open Parameter queries from code" from the site http://www.mvps.org/access/queries/qry0003.htm I made up a test which I though looked pretty close...
7
9466
by: Dee | last post by:
Running an AfterUpdate event procedure, I get the following error: "Too few parameters. Expected 1." My code is as follows: Private Sub DealerID_AfterUpdate() Dim db As DAO.Database
4
5107
by: Polly | last post by:
I had a macro that ran a parameter query and created and opened an Excel file with the system date as part of the file name, but I had to change the file name by hand. So I converted the macro to...
9
3458
by: deko | last post by:
I'm trying to export to Excel with this: SELECT INTO .WorksheetName; The problem is with I've tried this:
3
4780
by: priscilla.jenkins | last post by:
Alright, I'm really new to SQL and VBA and all this, so I might be completely off course...but just tell me. I know C and Assembly, but that doesn't help me much here. I'm trying to create a...
24
22555
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
21
5714
by: Marc DVer | last post by:
I am trying to create a query that can be loaded as a querydef object but not having to assign values to the parameters if I don't want to. Normally when using a parameter query in VBA my code...
0
8291
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
3
5430
by: myemail.an | last post by:
Hi all, I use Access 2007 and have come across this error a number of times. I have two tables (customer information) which should contain - ideally - the same data. I create a query to compare...
0
7202
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
7278
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
7328
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...
1
6991
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...
1
5013
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...
0
4672
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...
0
3167
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
1512
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 ...
1
736
muto222
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.