Thank you both theDBguy & Gasman for so much insight.
just wanted to know that theDBguy last updated db was allowing me to export the excel without any error. However, it exports as-is the entire records from the queries/tables to excel except the query which has the date parameter set.
thanks
Hi Gasman. Let's back up a bit to make sure we're on the same page. If you can use TempVars, then try creating the following query:My confusion was that I *thought* referencing the form controls as criteria in the query (or using global/tempvars variables) would do the job, but it seems using as recordset is not the case.
I still do not understand what setting the parameter value to Eval(parameter.name) is meant to do.:banghead:
SELECT TempVars!TestVar AS TEST;
Set rs = CurrentDb.OpenRecordset("qryTest")
Set rs = fDAOGenericRst("qryTest")
Hi Gasman. Yes, Null is fine. All I was trying to demonstrate there was that first you got an error, then you don't, simply by using Leigh's function. If you want to try the ADO version, you'll need to set a reference to Microsoft ActiveX Data Objects x.x Library. Coincidentally, I figured out a way to make Leigh's function work with parameter queries too. I just don't know why he didn't make it that way. I might ask him about it.No, no error
I wrote a small sub and the value of TempVars!Test is NULL ?
BTW, what reference do I need for the ADO code please?
Hi Gasman. Glad to hear we're on the same page now. Manipulating the QueryDef object is basically what Leigh's function was doing, which you learned to do on your own. I always recommend his function whenever a user asks about the 3061 (too few parameters) error, because then they don't have to mess with QueryDefs. Cheers!Ah, OK, I misunderstood.
I could not see why aparameters would not be used if they were thereas Null would,not produce any data in most cases.?
I did wonder about having globals by the same name as the parameters, whether that would populate the parameters.
At least I played a little more with querydesf, which is something I had not used much previously.
Thank you for the reference. I was trying to use the recordset library
Edit. I *thought* I had already posted this, but could not see it, so wrote it again.
Hi. I'll let Gasman answer that question, since I mainly concentrated on your original problem with getting the 3061 error message. Otherwise, I will ask you to repost a copy of your db, so I can see how you implemented any of the solutions offered here to advise you on how to proceed from there. However, I can tell you now that the same logic you're using now can also be used to delete the data based on a date range. Cheers!Hi!
i am bit confused, Do i need to add anything more to the code.
Also, can these be applied with the same logic to delete the data from the respective tables based on date criteria. (business start date & business end date)
Hi. You're welcome. Gasman and I were happy to assist. Good luck with your project.Thank you both for your time and advice.
I will try and implement that.
i have already marked this thread as solved. Thank you once again
Run-time error "3219": Invalid Operation
H!! Guys
i tried using this to delete the data from the table and it gave me below error
data to delete was through delete query with start & end date prompt
any suggestions, Thanks
DELETE *
FROM tbl_Master
WHERE Entry_Date Between [Start Date] And [End Date];