A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using a query result in an expression



 
 
Thread Tools Display Modes
  #1  
Old July 11th, 2004, 09:25 AM
Phil Hood
external usenet poster
 
Posts: n/a
Default Using a query result in an expression

I have a query that checks to see whether a record already
exists in a particular table. The result if it does is
that Expr1 = -1

My question is how do I refer to this result and use it in
an expression?

What I'm looking to do is to open a different form if the
result is -1 so I was thinking of using a If/Then/Else
statement but I don't know how to refer to the result of
the query in the 'if' statement.

Any help would be appreciated.

Thanks

Phil.
  #2  
Old July 11th, 2004, 01:14 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default Using a query result in an expression

Phil

In queries, you use the IIF() function to accomplish If...Then...Else.

--
Good luck

Jeff Boyce
Access MVP
  #3  
Old July 11th, 2004, 05:46 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default Using a query result in an expression

You can retrieve the results of a query using a domain aggregate function
such as DLookup().
If DLookup("YourField","YourQuery") = -1 Then

--
Duane Hookom
MS Access MVP


"Phil Hood" wrote in message
...
I have a query that checks to see whether a record already
exists in a particular table. The result if it does is
that Expr1 = -1

My question is how do I refer to this result and use it in
an expression?

What I'm looking to do is to open a different form if the
result is -1 so I was thinking of using a If/Then/Else
statement but I don't know how to refer to the result of
the query in the 'if' statement.

Any help would be appreciated.

Thanks

Phil.



 




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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hidden files in Ms-Query cause ODBC connect errors or Query is wac needyourhelp General Discussion 4 July 12th, 2004 09:38 PM
Delete Query based on result of select query John Finch Running & Setting Up Queries 1 July 2nd, 2004 05:47 PM
Display a query result in form Le Tran New Users 0 June 15th, 2004 09:08 PM
query field reference help -dch Running & Setting Up Queries 4 June 2nd, 2004 07:30 PM
Readding Numerical value to ext Hoang Han Worksheet Functions 2 December 4th, 2003 05:37 PM


All times are GMT +1. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.