Access query setting out question

  The Transporter 10:33 29 Jul 2003

Hi all

I have created a database, which has a query and all is working great.

In one of the Criteria boxes i have a question which prompts for a name.

The problem i have though is that the name has to be typed perfectly.

i.e. example A

where the 'A' has to a capital letter. I have been mucking about with the expression so that it will allow variations of 'example'.

BUT i am having no like.

I would like the expression in the criteria box to be similar to this but work. :-)

[Please Enter Name] LIKE "example A" Or Like "example a" Or Like "exam*"

it would all be one line. (if it has come out different)

Is there anything i am missing as i need the question prompt as well as the like criteria after.

Thanks for all input. Please could any responses be explained in an "Idiots guide" way



  The Transporter 10:42 29 Jul 2003

I have a form which opens up as a maximum size so it fills the computer screen. It has a command button which sends me to a report in a print preview window. If i close this print preview window using the close button in the toolbar the form that i was just on has shrunk back to its samllest size possible. Is the anyway that i can keep this at a maximum size so it is the only form you can see?

  IanNiblock 11:32 29 Jul 2003

As far as the second question goes - If you open the properties window of the form that you want to be 'permanently' maximised, go to the Event tab and find the on Got Focus event. Place the cursor in the box next to this event and click on the ...

In the code window that appears type docmd.maximize

This should ensure that every time that form becomes the current form in view it is maximized.

  IanNiblock 11:34 29 Jul 2003

A way around the name problem that you mention in the first post would be to have a combo box on a form that lists all possible names, allow the user to select the name and then run the query by clicking on a button. The query could then look at the value of the combo box to get the required name?

  The Transporter 12:00 29 Jul 2003

Thanks for the the first answer to the 2nd of my questions. ALl seems to work now.

The second repsonse you gave. I have created a combo box which is using the table with the names in it. The command button i have created. WIth an expression i have put into the query using the build function.

I have firstly selected the form which has the combo box on it, then i have selected the name i gave for the command button. Then i double click on the "value" word to end up with an expression in the criteria section on the "name" field in my query.

It looks like

I have taken out the original file names or the values a and b. One thing though. Value a has commas in it. The actual query itself has commas in the title. Will this effect it?


Is there anything i have missed as it is not working.


  Taran 12:06 29 Jul 2003

You can use Like "a*" in the Criteria of the query to filter according to anything beginning with the letter specified, but this obviously only works with a pre-prepared query and creating a query for every letter of the alphabet and the means to run them is inconvenient to say the least.

Using this kind of Wildcard via a text input box is possible, but there are some coding headaches to potentially overcome which could also depend on the version of Access you are using.

The simplest method i know of is filtering by form.

Click the Filter by Form icon

Type criteria into field(s)

Apply Filter

You can then set up a command button to generate a report based on current form view.

To do this, follow these steps:

1. Open the form in Design view

2. Click the Print Report button that you put on the form

3. View the property sheet, click the Event tab, click in the OnClick property box and finally click the Build button.

The code for the Print Report button uses the OpenReport method along with a query to open the report and filter the information.

This would be along the lines of;

DoCmd.OpenReport strDocName, acViewNormal, "Form Filter Name"

Hope this helps.



  IanNiblock 12:13 29 Jul 2003

I'm not sure if commas in the name will cause a problem - although it is not really good practice to use commas in object names.

When you created the combo box how many columns did it have - is there simply 1 column with the name in or is there also a hidden column with an ID field? You can tell this by going into the proerties for the combo box and looking at the Column Count property in the Format tab.

If the value here is greater than 1 then it is possible that you are referencing the wrong thing - go into the Data tab and look at the Bound Column property - make sure that this value matches the column that contains the name.

If this is not the problem or it still does not work then post back.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Huawei MateBook X Pro review

8 digital brands that designed custom typefaces to save millions

How to speed up a slow Mac

Comment résoudre des problèmes d’impressions ?