dbTalk Databases Forums  

Update query criteria

comp.databases.ms-access comp.databases.ms-access


Discuss Update query criteria in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
max
 
Posts: n/a

Default Update query criteria - 01-04-2005 , 01:26 PM






I have about 20 different querys but they all have some fields that use
the same expression. I would like to add criteria to those fields
without opening every query individually. Plus this criteria changes
frequently. Is there a macro that I could write where I can enter the
criteria once and the macro inserts it into all the different querys?
I'm using Access 2000. Thanks Max


Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Update query criteria - 01-04-2005 , 02:27 PM






max wrote:
Quote:
I have about 20 different querys but they all have some fields that use
the same expression. I would like to add criteria to those fields
without opening every query individually. Plus this criteria changes
frequently. Is there a macro that I could write where I can enter the
criteria once and the macro inserts it into all the different querys?
I'm using Access 2000. Thanks Max

Are the queries used in forms? If so, why not use filters on the
queries. IOW, create your generic, show all queries and then filter the
query based on criteria.

I suppose with some exploration I could figure out a macro, but coding
is pretty straight forward. The main rules to recognize are:
Strings are encased in quotes
Dates are encased in pound signs
Numbers are not encased

LastName = 'Smith'
Today = #1/4/2004#
Amount = 1.01

Here is some sample code you can place in an event to filter a query.
It will select all sales records from today where the sales amount is
greater $100 in the Electronics dept.

Me.Filter = "[SalesDate] = #" & Date() & "# And [Dept] = 'Electronics'
And [SalesAmount] > 100"


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.