By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,915 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Copying data WITHIN a form

P: 2
Dear All,

I'm creating a simple purchasing database.

The user enters the purchasers name and address.

Later on in the same form it asks for the credit card registered address and also the despatch to address.

As it is very very likely that these will all be the same address i want to add in a button that says "copy address".

But i can't figure it out. I guess I need to do a save command on lost focus of the main address entering, but can anyone help me urgently!?

Ta,

Nic
Feb 27 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,315
In the On Click event you will have to assign the values from the prior controls to the new ones.
Expand|Select|Wrap|Line Numbers
  1. [New Address] = [Old Address]
Feb 27 '07 #2

ADezii
Expert 5K+
P: 8,597
Dear All,

I'm creating a simple purchasing database.

The user enters the purchasers name and address.

Later on in the same form it asks for the credit card registered address and also the despatch to address.

As it is very very likely that these will all be the same address i want to add in a button that says "copy address".

But i can't figure it out. I guess I need to do a save command on lost focus of the main address entering, but can anyone help me urgently!?

Ta,

Nic
Assumptions:
__1 The Command Button is named cmdCopyAddress
__2 The Purchasers Address Field is named cmdPurchasersAddress
__3 The Credit Card Address Field is named txtCreditCardAddress
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCopyAddress_Click()
  2. On Error GoTo Err_cmdCopyAddress_Click
  3.  
  4. If Not IsNull(Me!txtPurchasersAddress) Then
  5.   Me![txtCreditCardAddress] = Me![txtPurchasersAddress]
  6. Else
  7.   MsgBox "There is no Purchasers Address to copy", vbExclamation, "No Address"
  8. End If
  9.  
  10. Exit_cmdCopyAddress_Click:
  11.     Exit Sub
  12.  
  13. Err_cmdCopyAddress_Click:
  14.     MsgBox Err.Description, vbExclamation, "Error in cmdCopyAddress_Click()"
  15.     Resume Exit_cmdCopyAddress_Click
  16. End Sub
Feb 27 '07 #3

P: 2
lovely. thank you.

I have more problems now....

Form one links into form two.

Form two runs off of the data on form one and queries based on the data within.

SOmetimes, form two will behave and run. sometimes not and i get a blank grey screen. it is driving me loopy. I just can't see what is wrong.

Anybody fancy taking a look?
Feb 27 '07 #4

Rabbit
Expert Mod 10K+
P: 12,315
Can you describe the dependcies between the forms and the relationships between the underlying tables?

Also, is there any code/macros running?
Feb 28 '07 #5

Post your reply

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