473,383 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Help With CheckBox

101 100+
Hi,
My Project is in MS Access.
In that I am using one form for Shipping Entry.
In That I put One Check Box.
Now If Shipping Address and Billing Address Are same than I click on that CheckBox.So It will automaticaly enter whatever address entered in Billing Address into Shipping Address.Now uptill this point everything working fine.

Now I want this thing.
When I click again on that CheckBox Than it will automaticaly Delete Shipping Address.So If I want to enter Different Shipping Address I can.And If I clicked again after that than it will again automaticaly enter the Billing Address in Shipping Address.But I don't know how to do it?

In VB we can use (I don't know proper code for VB) something like this
if(CheckBox1.checked=true) then
xyz
else
xyz

Like I want to know how can I check that CheckBox Is Clicked before or not.
Thanks.
Feb 11 '08 #1
6 2463
Scott Price
1,384 Expert 1GB
It sounds like you might be better off using the Double-Click event to delete the existing shipping address, otherwise I think you're stuck using a more complicated code routine to first test if the shipping address exists then delete it.

Regards,
Scott
Feb 11 '08 #2
MMcCarthy
14,534 Expert Mod 8TB
If checkbox is named CheckBox1 then in the after update event of the checkbox.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckBox1_AfterUpdate()
  2.  
  3.     If Me!CheckBox1 = -1 Then
  4.         Me!ShippingAddress = ""
  5.     Else
  6.         Me!ShippingAddress = Me!BillingAddress
  7.     End If
  8.  
  9. End If
  10.  
However, be careful with the code here as it will replace the existing shipping address with billing address when unclicked regardless of whether you wish to overwrite it. I can't imaging this is what you want.
Feb 11 '08 #3
billa856
101 100+
I was using this code.

Private Sub CheckBox1_AfterUpdate()

If Me!CheckBox1 = checked Then
Me!ShippingAddress = ""
Else
Me!ShippingAddress = Me!BillingAddress
End If

End If
But now its working when I put -1 instead of checked.
Thanks For ur Help.
Feb 11 '08 #4
MMcCarthy
14,534 Expert Mod 8TB
I was using this code.



But now its working when I put -1 instead of checked.
Thanks For ur Help.
You're welcome. For future reference, checkboxes have 3 states rather than the two most people think of.

Checked - Returns -1
UnChecked - Returns 0
Neither (This happens when you don't default the checked state of the checkbox to 0) - Returns Null
Feb 11 '08 #5
billa856
101 100+
You're welcome. For future reference, checkboxes have 3 states rather than the two most people think of.

Checked - Returns -1
UnChecked - Returns 0
Neither (This happens when you don't default the checked state of the checkbox to 0) - Returns Null
Hey,Thanks for further info.I am sure it will be helpfull in future.
Feb 11 '08 #6
MMcCarthy
14,534 Expert Mod 8TB
Hey,Thanks for further info.I am sure it will be helpfull in future.
No problem.
Feb 11 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Kurt A. Kaylor | last post by:
Hey, I am trying to get some code I have written to work. Runs well until I make a request. The I get some problems with PHP related to an SQL statement. Here are the errors :Warning:...
1
by: abs | last post by:
Hi. I've got such html source: <form name=my_form> <input type=checkbox class="a"><input type=checkbox class="b"><br> <input type=checkbox class="a"><input type=checkbox class="b"><br> <input...
11
by: Jack | last post by:
I have a asp form where among others there are few text boxes and one check box. The checkbox is to indicate whether the entry is final. The checkbox is attahced to a field in table of type...
3
by: Adam Toline | last post by:
In reference to the following: http://www.bellecose.com/form.htm At the top of each column there is a box for "All". When one is checked I need to check all of (and only) those boxes...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
2
by: I am Sam | last post by:
Ok I set up a button column to delete an individual record. Nothing happens when I test it. Someone please help understand why. Below is the associated coding: DataGrid control: ...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
1
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
1
by: Mike Bahr | last post by:
Hi All, Im not very well versed in javascript at all so hoping someone can help me out here. I have a page that uses pairs of radio buttons to toggle visibility of some table columns. I need...
3
by: milov | last post by:
Project to do simulation testing (me teacher). Page one writes in real time to page two...both displayed at sam time with frames. Code below. Problem...I want to keep score. Each choice needs a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.