updating text fields with option buttons

  • Thread starter Thread starter redtechcoms
  • Start date Start date
R

redtechcoms

I new to VBA and having a few problems with a database I'm working on.

I have a form that contains customer details. The are two sections one
for the Registered Office Address and one for the Trading Office
Address. I want to be able to place 2 option buttons (yes/no) on the
form that will allow the user to auto fill the Trading Office Address
fields if the Trading Office is the same as the Registered Office.

Any suggestions on the best code to use would be greatly appreciated.

Kind regards

David
 
David,
Rather than an option group, why not just place a button on your form to
copy the info. Not clicking the button is the equivalent of a No response.
I'd use the Dbl-Click event of the button to trigger the copying. That
way it wouldn't be so easy to trigger inadvertently.

On the Dbl-Click event of your cmdCopyRegOffice... (use your own field
names)
TOName = ROName
TOAddress = ROAddress
etc... for all your fields.
 
Thanks Al

If you are able to provide a little more detail on how the code should
look this would be much appreciated.


Regards


David
 
Here's the code I used for the same purpose. Use your own field names.

Private Sub btnAddrCopy_DblClick(Cancel As Integer)
Dim Response As Integer
Response = MsgBox("Copy Customer Address to Mailing Address?", 36, "Copy
Address")
If Response = vbYes Then
[MailName] = [CustName]
[MailAddr1] = [Addr1]
[MailAddr2] = [Addr2]
[MailCity] = [City]
[MailState] = [State]
[MailZip] = [Zip]
End If
End Sub
 
Back
Top