p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   check box help? (http://p2p.wrox.com/showthread.php?t=66204)

dstein4d February 26th, 2008 06:02 PM

check box help?
this should be very simple for the experts but since i'm a novice at this even the easy stuff throws me for a loop.

i have a check box on my form to carry over the customers address to the billing address if its the same. if left unchecked then the user needs to fill in a different billing address but if the user checks the box i need the text boxes to fill in the customers address. whats the best way to set this up?

do i write a procedure for each text box using the "BeforeUpdate"?
does anyone have a simple code to do this?

mmcdonal February 27th, 2008 09:47 AM

You would use the Before Update and Before Insert events of the data entry form. Then check for a value in the check box, and if it = -1, then do this:

Me.Address1 = Me.BillingAddress1
Me.Address2 = Me.BillingAddress2
Me.City = Me.BillingCity

Did that help?


Look it up at: http://wrox.books24x7.com

jeremy1048 February 27th, 2008 09:54 AM

Following on from mmdonal's post which I agree is the simplest solution to the issue you have. Have you considered the situation where you have to change the billing address and take the tick out?

A simple question messagebox checking the user's intentions would address the issue. With an IF statement testing the answer it afterwards would allow for this option.

A bit more work, however it will allow more flexibility in your application and counteract inputting errors further down the line.

All times are GMT -4. The time now is 09:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.