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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
66,955
Office Version
  1. 365
Platform
  1. Windows
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

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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

smoothlarryhughes

New Member
Joined
Feb 12, 2009
Messages
39
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

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
When the want all the data how willl you be able to tell?
 
Upvote 0

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
66,955
Office Version
  1. 365
Platform
  1. Windows
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

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
66,955
Office Version
  1. 365
Platform
  1. Windows
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,191,049
Messages
5,984,358
Members
439,882
Latest member
gerdc

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
Top