If then statment for control source

NSTLouis

Registered User.
Local time
Today, 11:32
Joined
Feb 9, 2001
Messages
11
I am using the following in the control source of form2's Lname field:

[Lname]=Forms![form1]![Lname of form1]

However, if the user came to form2 by way of the switchboard or if Lname was blank in form1, I want the user to instead get the prompt [Enter Last Name].

How can I ammend the above procedure to allow for this if, then situation? Or is it necessary to create copies of the form based on the same query but with different control sources for each scenerio?
 
Look up the IsLoaded function in Northwind
If IsLoaded("MyForm") Then etc
 
Thanks, but I do not know a bit about visual basic. I'll give it a try, but if anyone has any other ideas that use macros or event procedures I'd prefer to go that route.:confused:
 
You will progress with you development alot quicker if you forget about macros.

***

You could set the "where" criteria in the open form action of the command button on Form1 that is opening Form2.

If both forms contain a field called Lname, then you can construct the Where statement using the Command Button wizard.

It will construct it in the form of:

DoCmd.OpenForm "Form2", , , "[LNameOnForm2] =" & Me.LNameOnForm1

By doing this, you can remove the criteria statement in your query.

However, unless you follow Rich's advice, you will not be able to have a Prompt under the circumstances of opening the form from switchboard etc.

Brad.
 
Thanks for all the advice, I will give that a try. Since you are the second person in as many posts to tell me to ditch the macros, I guess I should heed that advice.
 

Users who are viewing this thread

Back
Top Bottom