Square Bracket Box

smoothlarryhughes

New Member
Joined
Feb 12, 2009
Messages
39
I use a bunch of queries with the [] square brackets to pull data I want...however sometimes I want to just pull all the data. Is there something that I can type in so it pulls all the data????

Thanks,

Jim
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Not sure what you mean. Something like this, perhaps?
Code:
Select [Table1].*
From [Table1];
If not, please post the SQL of your query here and try explaining it again in more detail.
 
Upvote 0
Hi Jim,

As Joe said you can use
SELECT [MyTable].* FROM MyTable

However, unless you truly have a huge amount of SQL you generally will get better performance from specifically listing the fields -- at least, according to articles written by people who should know.

You probably won't notice a difference until you pull tens of thousands of records from a table with many columns. Then it will matter.

BTW, if you want a good book on SQL I have recently come across Simply SQL, available from Sitepoint.com. It looks like a very good primer, especially if you don't use SQL all the time.

Denis
 
Upvote 0
This is what I mean. Say I have a basic query in access and for my queria criteria I put brackets [enter criteria here] so that when I actually run the query a box pops up and I can enter which criteria i want the query to return. My question is sometimes I will want the query to return all the data. Is there a way to do this without actually amending the query and deleting the [enter criteria here]
 
Upvote 0
Aahh...

You've got a parameter query.
One option is to have 2 versions of the query, with and without the parameter, and attach each to different buttons on a form. That is simple to do but will only work if the query is stand-alone, ie you aren't running a report based on the query.
A second, more high-tech option is to rewrite the query in code, based on whether a text box on a form is populated or not. This is more flexible and you don't get prompted for the parameter each time the query runs.

Which would best suit your needs?

Denis
 
Upvote 0
When the want all the data how willl you be able to tell?
 
Upvote 0
Actually, there is an easy way to do what you want to do. Enter criteria like this:
Code:
 Like [Enter Criteria] & *
When the Parameter pops up, if you leave it blank and hit enter, it will return all records. Otherwise, enter the criteria that you want.
 
Upvote 0
Sometimes I miss the simple answers...
We all do, from time-to-time.

Usually, I am on the other end of this situation!;)
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

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