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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |