run-time variable to supply value to parameter query

WalksFar

New Member
Joined
Sep 7, 2007
Messages
11
OK... newbie here.

I've figured out how to create and use a parameter query. I've seen how the paramaters can be tied to the values on a form, to replace the individual pop-ups with the single form... I'm having a hard time figuring out how to use run-time variable values from a VBA sub instead. Is there a way of supressing the parameter pop-ups from displaying, and to provide the needed values at run-time via VBA?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Yes, you can embed function calls within SQL statements and have it evaluate to a text result which is then evaluated as a SQL statement.

I'm going to be very lazy and just dump a live example. In this example, DatePuller is a Public Function call that returns a String Value.

Incidentally, the below is a simple reminder query - I have a bunch of tasks (report generation) that are managed from an Access MDB - and the below shows me a list based on predefined schedules of what is left at any given point in time.

Code:
SELECT tblTask.task_name, tblTask.dteStamp, tblTask.ScheduleType, DatePuller([dteStamp],[ScheduleType]) AS Pending
FROM tblTask
WHERE (((DatePuller([dteStamp],[ScheduleType]))>=DateSerial(Year(DatePuller([dteStamp],[ScheduleType])),1,1) And (DatePuller([dteStamp],[ScheduleType]))<=Date()) AND ((IsNull([dteStamp]))=False) AND ((IsNull([ScheduleType]))=False))
GROUP BY tblTask.task_name, tblTask.dteStamp, tblTask.ScheduleType, tblTask.disable
HAVING (((tblTask.ScheduleType)<>'None') AND ((tblTask.disable)=False))
ORDER BY tblTask.ScheduleType, tblTask.task_name, tblTask.dteStamp;
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top