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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro Conditional Statement



 
 
Thread Tools Display Modes
  #1  
Old January 20th, 2005, 02:29 PM
Patrick
external usenet poster
 
Posts: n/a
Default Macro Conditional Statement

I'm trying to use a simple statement that compares two values in a table of
mine. If they are the same and the statement is true, the application will
open a new form. If it is false, then the application will throw up an
error. This is just an implementation of a password for each user. The
statement I am using is: [Emp].[EmpPW]=[Emp].[PwCurrent]

Will this work? When I run the app., nothing happens and I don't get an
error.
  #2  
Old January 20th, 2005, 04:51 PM
Larry Daugherty
external usenet poster
 
Posts: n/a
Default

The statement you've given sets EmpPW to what is in PWCurrent. You don't
show any error code. It's sometimes helpful to do simple things like that
in the Immediate window so that you can check values right away.

HTH
--
-Larry-
--

"Patrick" wrote in message
...
I'm trying to use a simple statement that compares two values in a table

of
mine. If they are the same and the statement is true, the application

will
open a new form. If it is false, then the application will throw up an
error. This is just an implementation of a password for each user. The
statement I am using is: [Emp].[EmpPW]=[Emp].[PwCurrent]

Will this work? When I run the app., nothing happens and I don't get an
error.



  #3  
Old January 20th, 2005, 06:21 PM
Patrick
external usenet poster
 
Posts: n/a
Default

Actually I switched the statement to :
[Forms]![PwForm]![EmpPW]=[Forms]![PwForm]![PwCurrent]

This actually does work. The statement does not set a value of one to the
other. In the conditional box, it only checks to see if the statement is
true or false.

"Larry Daugherty" wrote:

The statement you've given sets EmpPW to what is in PWCurrent. You don't
show any error code. It's sometimes helpful to do simple things like that
in the Immediate window so that you can check values right away.

HTH
--
-Larry-
--

"Patrick" wrote in message
...
I'm trying to use a simple statement that compares two values in a table

of
mine. If they are the same and the statement is true, the application

will
open a new form. If it is false, then the application will throw up an
error. This is just an implementation of a password for each user. The
statement I am using is: [Emp].[EmpPW]=[Emp].[PwCurrent]

Will this work? When I run the app., nothing happens and I don't get an
error.




  #4  
Old January 21st, 2005, 08:34 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default

Patrick,

That's good. If your macro is being run from an event on the PwForm
form, you can dispense with the form reference, and just do it like this...
[EmpPW]=[PwCurrent]

You can't check the value of table or query fields in this way, as
Access has no way of knowing which record you are referring to. If you
wanted to check the password entered on the form against the value in a
table, you can use the DLookup() function.

--
Steve Schapel, Microsoft Access MVP

Patrick wrote:
Actually I switched the statement to :
[Forms]![PwForm]![EmpPW]=[Forms]![PwForm]![PwCurrent]

This actually does work. The statement does not set a value of one to the
other. In the conditional box, it only checks to see if the statement is
true or false.

 




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
Cannot delete macro LookupMW Min New Users 7 June 10th, 2004 03:27 AM
word error mac General Discussions 1 May 6th, 2004 08:14 AM
conditional formatting triggered by macro jonah Worksheet Functions 2 March 17th, 2004 09:11 PM
min conditional statement Maria L Worksheet Functions 2 November 12th, 2003 06:56 PM
Macro Nicole Worksheet Functions 4 October 9th, 2003 09:53 PM


All times are GMT +1. The time now is 03:05 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.