Help with buttons

dsomers

Registered User.
Local time
Today, 00:33
Joined
Nov 13, 2003
Messages
131
Hello all! I need on my new tenant form a button that opens my lease form. But I need to have that button make the determination of whether they've added the new tenant first. If they have, open the lease form, if not display a message box saying you must add the tenant before putting lease information in.

Also, once they add the new tenant, I would like for the tenant information they just entered to still remain on the tenant form, not start a new record. Is there a way I can do this?

I've attached a copy of the program so everyone can see what I'm talking about.

Thanks!
David Somers
 

Attachments

Hi,

There was no lease form in that database, but anyway


Create a command button and stop the wizard,
Add this code to the onclick event:


If isnull(FirstName) then

msgbox "Please enter details fool!"

else

docmd.openform "LeaseForm"


obviously your lease form may not be called LeaseForm
 
The lease form name is subfrmNewTenantNew. I need to determine if they've added the record by clicking the add button, not by if the textfield is blank. How would I make that determination?

Thanks!
David Somers
 
Last edited:
Hi,

I would add a boolean field (yes/no) to the table, set it to no as default, then when they click the button set it to yes.

I am not really understanding why you want this on the button click, surely if they have added a first name then they have added a recoed.
 
I want to make sure its "dummy proof". :)

How about this: Declare a public variable as boolean and then when they hit add, set it to true and then when they click the button to open the link use that variable for the determination?

Thanks!
David Somers
 
Yeah public variable would work, but will only work while the form is open, if you close the form then the variable will be killed.

Better to store one for each record in the table, but it is up to you.
 
That worked.. Thanks for the little push. :)

Thanks!
David Somers
 

Users who are viewing this thread

Back
Top Bottom