473,626 Members | 3,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'Same as above address' Tick box

I've got a form with feilds: Address, Suburb, State, Pcode (for the
Location Addres) and then: PAddress, PSuburb, PState, PPcode (for the
Postal Address).

When the postal address is the same as the location address, it becomes
cumbersome to retype/copy the address into the postal address fields so
I created a tick box (like a 'same as above' thingy) where on
'afterupdate' i've put the following code as an Event Procedure:

Private Sub Same_As_Above_A fterUpdate()
[PAddress] = [Address]
[PSuburb] = [Suburb]
[PState] = [State]
[PPcode] = [Pcode]
End Sub

The obvious problem here is that it updates all 4 postal address fields
wether you tick or untick the box.

What code do i need to insert (or create from scratch) to tell it to
only update the 4 postal address fields _when_the_box_i s_ticked_?
Also, it would be nice to have some code that tells it to clear the 4
fields if the box is 'unticked' later.

Any help would be appreciated!!

Thanks
Farqs

Nov 13 '05 #1
11 4157
Br
farqs <mf*****@yahoo. com.au> wrote:
I've got a form with feilds: Address, Suburb, State, Pcode (for the
Location Addres) and then: PAddress, PSuburb, PState, PPcode (for the
Postal Address).

When the postal address is the same as the location address, it
becomes cumbersome to retype/copy the address into the postal address
fields so I created a tick box (like a 'same as above' thingy) where
on 'afterupdate' i've put the following code as an Event Procedure:

Private Sub Same_As_Above_A fterUpdate()
[PAddress] = [Address]
[PSuburb] = [Suburb]
[PState] = [State]
[PPcode] = [Pcode]
End Sub

The obvious problem here is that it updates all 4 postal address
fields wether you tick or untick the box.

What code do i need to insert (or create from scratch) to tell it to
only update the 4 postal address fields _when_the_box_i s_ticked_?
Also, it would be nice to have some code that tells it to clear the 4
fields if the box is 'unticked' later.

Any help would be appreciated!!

Thanks
Farqs


Ummm, simple.....

Private Sub Same_As_Above_A fterUpdate()
If Me![Same_As_Above] Then
Me![PAddress] = Me![Address]
Me![PSuburb] = Me![Suburb]
Me![PState] = Me![State]
Me![PPcode] = Me![Pcode]
Else
Me![PAddress] = Null
Me![PSuburb] = Null
Me![PState] = Null
Me![PPcode] = Null
End If
End Sub

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2
.... and i just thought of something else...

It would be nice if a warning popped up if you were to tick the box
when the postal address is already typed in, BUT is different to the
location address. (useful for if someones postal address changes to
their location address (for some reason), at a later date)

Cheers
Farqs

Nov 13 '05 #3
You're a legend Bradley!! Works like a charm.

Cheers
Farqs

Nov 13 '05 #4
Sorry that should have read:

....useful for if you tick the box by mistake)

Sorry, wasn't thinking straight

Farqs

Nov 13 '05 #5
Br
farqs <mf*****@yahoo. com.au> wrote:
... and i just thought of something else...

It would be nice if a warning popped up if you were to tick the box
when the postal address is already typed in, BUT is different to the
location address. (useful for if someones postal address changes to
their location address (for some reason), at a later date)

Cheers
Farqs


Again simple... just do a comparison like.....

If (Me![PAddr] = Me![Addr]) And (Me![PSuburb] = Me![Suburb]) And
[............etc]
Then

Msgbox "Warning"
End If
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #6
Sorry Bradley. I think i confused things. I'll try again.

Is it possible for a warning message to pop up ONLY when you tick the
box WHEN the postal address has already been typed in AND is different
to the location address? (as a safeguard for if you tick the box by
accident) It should not pop up if the postal address fields are blank
or when 'unticking' the box.

When the warning pops up, it should give you the option to cancel or
continue BEFORE updating/changing the fields.

Hope that makes sense.

Cheers

Nov 13 '05 #7
Br
farqs <mf*****@yahoo. com.au> wrote:
Sorry Bradley. I think i confused things. I'll try again.

Is it possible for a warning message to pop up ONLY when you tick the
box WHEN the postal address has already been typed in AND is different
to the location address? (as a safeguard for if you tick the box by
accident) It should not pop up if the postal address fields are blank
or when 'unticking' the box.

When the warning pops up, it should give you the option to cancel or
continue BEFORE updating/changing the fields.

Hope that makes sense.

Cheers


That's exactly what I understood... do you want me to do ALL the work
for you?

Just modify the last code I gave you and insert a check to see if the
values are the same and put a warning message in.
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #8
Again...sorry Bradley. I didn't make myself clear.

I'm not a newb to Access, but am a newb to the coding side of it. This
is why i'm posting. The only coding I know is when searching for other
topics on google and dabbling with the coding I've found in the search.
Having never come across this latest requirement of mine in access and
never having learnt the programming/coding side of it, your second
response was a bit beyond my capabilities.

I did have a play with it though (as that's how I learn things and
because you suggested it) and found that the warning box only allows
you to press OK. It doesn't give you the option to change your mind
(in the case of having pressed it in error).

In your coding above, it compares when [paddr] = [addr] etc. Shouldn't
it be searching for when [paddr] does not = [addr] or am i reading your
coding wrong?

Also, the warning pops up every time you activate the tick box, even
when the postal address feilds are blank. It should only pop up when
something different is in the postal address

Regards
Farqs

PS I really appreciate your help.

Nov 13 '05 #9
Br
farqs <mf*****@yahoo. com.au> wrote:
Again...sorry Bradley. I didn't make myself clear.

I'm not a newb to Access, but am a newb to the coding side of it.
This is why i'm posting. The only coding I know is when searching
for other topics on google and dabbling with the coding I've found in
the search. Having never come across this latest requirement of mine
in access and never having learnt the programming/coding side of it,
your second response was a bit beyond my capabilities.

I did have a play with it though (as that's how I learn things and
because you suggested it) and found that the warning box only allows
you to press OK. It doesn't give you the option to change your mind
(in the case of having pressed it in error).
Look up the Access help. There are several options for what appears in
your message box (eg. Yes/No, OK/Cancel....). Then read the return
value of the Msgbox to determine what the user pressed and then take the
appropraite action.

eg.

Dim r as Long
r = MsgBox("prompt" , vbExclamation + vbOKCancel +
vbDefaultButton 2,"title")
If r = vbOK Then
'copy field values
End If
In your coding above, it compares when [paddr] = [addr] etc.
Shouldn't it be searching for when [paddr] does not = [addr] or am i
reading your coding wrong?
It was just an example. Alter the logic to suit.
Also, the warning pops up every time you activate the tick box, even
when the postal address feilds are blank. It should only pop up when
something different is in the postal address


Then add more checks before you open the message box.

eg. (check the logic... it's just an example)

If ((Not IsNull(Me![Addr]) And (Me![Addr] <> Me![PAddr])) And
((Not IsNull(Me![Addr2]) And (Me![Addr2] <> Me![PAddr2])) And .... etc
etc
Then
Msgbox "Warning"
End If

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
31217
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith"> </Authors>
44
1941
by: bq | last post by:
In the code int a; int b = -1; does ANSI C guarantee that "b" is located in memory right after "a" so that "a" refers to "b"? Thanks. bq
10
2190
by: Martin Eyles | last post by:
Hi, I want to make a scale on a graph, by telling asp to insert empty divs of class tick, and the setting the style in css. I am trying to get a 3D effect by using colored top and bottom borders on the divs, and setting their height to 0. The code bellow show an example tick, and it all looks beautiful in firefox, but in internet explorer, the height appears to be ignored. Does anyone have any ideas? Thanks, Martin
2
2482
by: Rich | last post by:
Here is what I am trying for randomizing 2 numbers in the same subroutine so that they are not equal to each other: Dim j As Integer, k As Integer j = New System.Random().Next(0, 10) k = New System.Random().Next(0, 10) But j and k are always equal to each other. So I through in Randomize( ) but that did not help. Is it possible to randomize 2 different numbers in the same sub so that they are not equal to each other? How to do this?
1
2929
by: Phoenix_ver10 | last post by:
I have a mailing list with multiple names going to the same addresses. I need one address with all the names for that address on it. I checked out the example on microsoft's site, but A: It doesn't work (error that there is an extra parenthise (sp?) ) and B: Will only let in two names for each record. If there are three, the middle on is deleted. Or to make things simpler, if nothing else, I'd like to add a field in the table that shows...
9
7287
by: appelsinagurk | last post by:
Hi I'm fairly new to .Net programming so I'll try to explain my problem as easy as I can, and in advanced sorry for my poor english. I've got some spare hours where I work, so I've decided to spend them learning C# .Net. I've done some smaller programming assignments and decided now to try a larger program. I'm trying to create a basic game where you the "hero" meets "villains" and monsters in an arena. I want the fighting to be like...
4
3199
by: paul.bentley | last post by:
I am trying to get a "Date entered" box to automatically fill when a tick box = true, without success so its over to the experts for some much needed help Thanks in advance
18
3096
by: sweeneye | last post by:
Hi, I'm basing a query on the variables used in a form. The database contains lots of problems, say with a computer and a tick box for the apropriate component like monitor, keyboard, mouse etc. and each has several eg problem 1 has a monitor and mouse problem My form then has what to look for tick boxes (tri-state) for each of these. I want my query to include all monitor problems when that is ticked and all monitor and mouse problems...
5
14504
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I am trying to get the DNS name of an arbitrary IP address on the network. If I use GetHostEntry as the documentation suggests I only get the name of the machine I am running the code on. All other IP’s returns the IP in the HostName property of the IPHostEntry object returned by GetHostEntry. If I use Dns.GetHostByAddress or Dns.Resolve I get the name, but these are marked as obsolete. What is the correct way to get this...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.