Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Parameter Query - Why this not working?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
neverumind@yourhouse.com - 15 Jan 2006 20:08 GMT
Private Sub btnCreateInvoice_click
Dim db as database
Dim rsD as recordset
Dim qryD as querydef
Dim param as Parameter
Dim patientnbr as integer
Dim filterdate as date

Set db = currentdb
patientnbr = 4197
filterdate = FormatDateTime("1/1/1900", vbShortDate)
Set qryD =  db.Querydefs("qryDetailQuery")
For Each param in qryD.parameters
    param.value = Eval(param.name)
Next param

Set rsD = qryD.openrecordset(dbOpensnapshot)

End Sub

In the query saved in the database I have two parameters "[filterdate]" and
"[patientnbr]" .

The last line of the  code is generating  an error message saying it is
looking for 2 parameters. This would lead me to believe that the
Eval(Param.name) is not evaluating to the variables I have.  Can anyone
help?
Douglas J. Steele - 15 Jan 2006 21:00 GMT
It would probably be simpler strictly to use:

Set qryD =  db.Querydefs("qryDetailQuery")
qryD.parameters("patientnbr") = 4197
qryD.Parameters("filterdate") = _
    FormatDateTime(#1/1/1900#, vbShortDate)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Private Sub btnCreateInvoice_click
> Dim db as database
[quoted text clipped - 23 lines]
> Eval(Param.name) is not evaluating to the variables I have.  Can anyone
> help?
Ron H - 16 Jan 2006 11:31 GMT
Thanks Doug!  Am I using Eval(param.name) wrong in my code?  Running it with
an  extra line in the For Each loop shows Param.Name has the brackets around
it.  How is Eval supposed to be used?

> It would probably be simpler strictly to use:
>
[quoted text clipped - 30 lines]
>> Eval(Param.name) is not evaluating to the variables I have.  Can anyone
>> help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.