Another Access 2003 / VBA request

Go to: Forums > Technology: Programming Languages

There are 8 postings to this topic on our Member website and this page runs 7 days behind our Member website. For the full topic click to sign up to OUTeverywhere.

A topic from Technology: Programming Languages

viceTue 28/10/08 17:05

 

Another Access programming query for you. I'm learning as I go and a complete newby.

I have a database table of various records. I'm trying to create a user-friendly query, so that Mrs Miggins down the road can find records using various criteria which she specifies.

For example, lets say my database records the shopping habits of various people.

I have records of:

Name of person going shopping
Which Supermarket they go to
Which County the Supermarket is in
Which Town the Supermarket is in
What type of fruit they decided to buy.

I've created a search form, and linked this to the various underlying tables - so, for example I have a combo box listing Tesco, Morrisons, Asda etc, which is linked to the main table. My member of staff can select Supermarket as a search criteria.

In the 'Criteria' section of the accompanying query, therefore, I've used =[Forms]![Search Form]![Supermarket] to enable the query to look at what my member of staff has selected.

It works when I have one criteria, or when all of the search boxes are filled in. But it comes back with no results if some of the seach boxes aren't filled in.

So, for example, if we wanted to list people who visited Asda in Birmingham in the West Midlands and who bought Apples I could do. But if I wanted to leave everything else blank and just see people in Birmingham, I couldn't.

Is there a AND / OR thing I could stick in the Criteria box which means that the query will return proper results if I only enter a couple of search items?

I don't understand this post myself, and I'm the one who's writing it...

duncanTue 28/10/08 17:57

photo

You know, at one time I earned money by designing and developing Access/VBA applications...

I have since forgotten everything I knew tho! However I always used to use SQL to do DB searches, and passed the values in from the VBA forms (SQL being a much more powerful method to search for data).

In theory what you want is possible - but I honestly can't remember how to do it!

(God my brain is useless these days - unless it's doing 'Do Chip' it just doesn't work :S)

viceWed 29/10/08 11:04

 

Thanks Duncan.

Maybe one option is to create macros to do the following

Run Query for Field One, then
Run Seperate Query for Field Two
etc, then
Merge results of queries
Check for Duplication,
Remove duplication Display results.

duncanWed 29/10/08 11:16

photo

quoting > "Run Query for Field One, then
Run Seperate Query for Field Two
etc, then
Merge results of queries
Check for Duplication,
Remove duplication Display results."


That is an option, but it's overly complicated really.

If it was me designing the form/search, I'd have something like:

GET * FROM table WHERE SHOP = Form.shop AND LOCATION = Form.location

The Form.shop would return the value selected from the Shop dropdown box, and probably a '*' for "All" (that will return everything in the DB if my SQL is still working)

Like I said tho, its been a while (and I never really liked the in-built Forms/Search things that Access gave you for the tables - but that was just me probably).

No doubt someone who has done this recently will tell you a better way!

viceWed 29/10/08 11:28

 

Thanks Duncan, I'll try the *. It's only returning results when I input something into a specific combo box.

*mutters and shakes fist at machine*

There are 3 more postings on this topic on our Member website. For the full topic click to sign up to OUTeverywhere right now.

Similar topics

You may also find these other topics of interest:

Enjoy chatting with our members

Click to join and start meeting people today

Imagine joining a social network of people from all around the country and see how you'll feel a year from today. You're increasing your circle of friends. You're doing more of the stuff you enjoy. You're having a great time meeting new people in your area. You're seeing all the benefits of becoming a member of OUTeverywhere. It still feels great making new friends and every day you're hearing more and more about the stuff that everyone's doing. You're joining in. Now, that was easy, wasn't it?

We make meeting people easy. Click to sign up to OUTeverywhere and get up and do something different!

PLEASE NOTE: Events are listed on this website on behalf of organisers in accordance with the Terms of Membership of OUTeverywhere and only if they have chosen broad publicity when adding their event to the Member Events calendar. As such, events are not necessarily affiliated to or endorsed by OUTeverywhere and may not be organised by the person who has listed the event: the person listing this event may simply be attending an event organised by another person or organisation and may wish to meet other people sharing their interest in the event. The mention or appearance of any person or organisation featured on these pages is not to be taken as any indication of sexual, social or political orientation of such persons or organisations. We cannot guarantee that the information is accurate and recommend that you always seek to contact the organiser directly to confirm full details of any event. Under no circumstances will we be responsible for any loss or damage resulting from reliance on, use or misuse of, the information on this website.

Our Vision | Our Team | Privacy Policy | Identity Theft Protection | Terms of Membership

Chat and Meet People

Enter one or two words to tell us something you enjoy:

Or enter a postcode or the name of a place:

Latest Shout OUT

Broadcast to the gay world with our public Shout OUTs service! Post on our member website or from your mobile phone and raise your profile.

photo

Darren B (daz30775) from Morley in Leeds in United Kingdom shouts OUT: "HELLO!!!! :-))))"

Events Calendar

January 2009  >
S M T W T F S
    123
45678910
11121314151617
18192021222324
25262728293031
       

This Topic's Tags

Members tag topics with key words to help us find similar topics.

Discover GMEET

Add all your web profiles to the new GMEET.com website profiles directory service. Supports Facebook, YouTube, MySpace, Bebo, LinkedIn and dozens more. For social and business networking, web personals and online dating.

Contact us

OUTeverywhere is created and managed by Up and Doing Ltd. Copyright © 1995-2009. All rights reserved. Contact us by email to hello@outeverywhere.com.

OUTeverywhere