Getting query criterion

Melody Thaw

New Member
Joined
Dec 6, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I would like to ask about Query Criteria in Access VBA. I am new to VBA.
Now I am trying to create customize query design view form with VBA. I want to show fields name and criteria of saved query.
But I am not sure how to get query criteria expression. I don't know whether there is a way to get criteria expression from a query with VBA.

So could someone help me for it?

Thanks in advance.

Melody
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Do not believe in starting off easy, do you? :)
I believe you would need to parse the sql string, looking for Where or Having until the next keyword like Order.
 
Upvote 0
You want only the criteria or you want the whole sql statement? For the latter, not so hard (stored query is a QueryDef object and has a sql property that is the full sql of the query). Getting only the criteria is another story as welshgasman says.
 
Upvote 0
melody,
I suggest you show us a mockup of what you expect.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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