Duplicate data from field into another field in same form?

Can I duplicate data from one field on a form into another field in the same 
form?  

For example:
On our exhibitor entry form, the Program Contact info (fields for name, 
address, phone, fax, email) is entered first.  Mail Contact info is often the 
same, but not always.  

Is it possible to autopopulate the Mail Contact with the data from the 
Program Contact, but allow me to enter new data if necessary?

If so, can you tell me exactly how?

Thanks!
-- 
Andi
0
Utf
3/23/2007 4:46:24 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
1859 Views

Similar Articles

[PageSpeed] 24

On Fri, 23 Mar 2007 09:46:24 -0700, Andi <Andi@discussions.microsoft.com>
wrote:

>Can I duplicate data from one field on a form into another field in the same 
>form?  
>
>For example:
>On our exhibitor entry form, the Program Contact info (fields for name, 
>address, phone, fax, email) is entered first.  Mail Contact info is often the 
>same, but not always.  
>
>Is it possible to autopopulate the Mail Contact with the data from the 
>Program Contact, but allow me to enter new data if necessary?

Sure. You'll need just a little bit of VBA code.

Assuming there are textboxes named MailAddress, MailPhone, MailFax, MailEmail
and ProgramAddress, ProgramPhone, ProgramFax, ProgramEmail you can put code in
the AfterUpdate event of each Program textbox such as:

Private Sub ProgramAddress_AfterUpdate()
If IsNull(Me!MailAddress) Then
    Me!MailAddress = Me!ProgramAddress
End If
End Sub

This checks to see if the mail address control is empty (wouldn't want to
stomp on data that was there!) and if so copies the value.

A couple of suggestions: Don't use Name as the Name of a field or a control;
it's a reserved word and can cause problems. People's names should generally
be stored in (at least) two fields - LastName, FirstName; it's easy to
concatenate them for display and easier to search and sort. Address should
probably also be split up - Address (or even AddressNo and Street), City,
State, Postcode. You may also want to consider a separate Phones table - lots
of folks have several phones these days, and it can be treated as a one to
many (with a PhoneType field for Work, Home, Cell, Fax, ...).


             John W. Vinson [MVP]
-1
John
3/23/2007 10:34:08 PM
John:

Thanks very much for your response -- sorry about the delay in getting back 
to you.

I tried the code you suggested, but I must be entering it incorrectly.  When 
I get to...
If IsNull(
....that line turns red and displays IsNull(Expression) As Boolean   

The first time I completed the code, the program data displayed in the mail 
field.  However, when I entered new data in the mail field, it also changed 
the program data.

Any thoughts?
-- 
Andi


"John W. Vinson" wrote:

> On Fri, 23 Mar 2007 09:46:24 -0700, Andi <Andi@discussions.microsoft.com>
> wrote:
> 
> >Can I duplicate data from one field on a form into another field in the same 
> >form?  
> >
> >For example:
> >On our exhibitor entry form, the Program Contact info (fields for name, 
> >address, phone, fax, email) is entered first.  Mail Contact info is often the 
> >same, but not always.  
> >
> >Is it possible to autopopulate the Mail Contact with the data from the 
> >Program Contact, but allow me to enter new data if necessary?
> 
> Sure. You'll need just a little bit of VBA code.
> 
> Assuming there are textboxes named MailAddress, MailPhone, MailFax, MailEmail
> and ProgramAddress, ProgramPhone, ProgramFax, ProgramEmail you can put code in
> the AfterUpdate event of each Program textbox such as:
> 
> Private Sub ProgramAddress_AfterUpdate()
> If IsNull(Me!MailAddress) Then
>     Me!MailAddress = Me!ProgramAddress
> End If
> End Sub
> 
> This checks to see if the mail address control is empty (wouldn't want to
> stomp on data that was there!) and if so copies the value.
> 
> A couple of suggestions: Don't use Name as the Name of a field or a control;
> it's a reserved word and can cause problems. People's names should generally
> be stored in (at least) two fields - LastName, FirstName; it's easy to
> concatenate them for display and easier to search and sort. Address should
> probably also be split up - Address (or even AddressNo and Street), City,
> State, Postcode. You may also want to consider a separate Phones table - lots
> of folks have several phones these days, and it can be treated as a one to
> many (with a PhoneType field for Work, Home, Cell, Fax, ...).
> 
> 
>              John W. Vinson [MVP]
> 
0
Utf
4/3/2007 8:48:02 PM
On Tue, 3 Apr 2007 13:48:02 -0700, Andi <Andi@discussions.microsoft.com>
wrote:

>Thanks very much for your response -- sorry about the delay in getting back 
>to you.
>
>I tried the code you suggested, but I must be entering it incorrectly.  When 
>I get to...
>If IsNull(
>...that line turns red and displays IsNull(Expression) As Boolean   
>
>The first time I completed the code, the program data displayed in the mail 
>field.  However, when I entered new data in the mail field, it also changed 
>the program data.

Please post your actual code, and the actual names of the controls involved.

             John W. Vinson [MVP]
0
John
4/5/2007 2:30:11 AM
John:

Thanks again for your help.

The current code for both fields is the same until near the end of the code. 
 I have put a dotted line where it changes.

What I would like to do is have the PRG CONTACT info autopopulate the MAIL 
CONTACT field, but then allow me to change the info in MAIL CONTACT if 
necessary (without affecting the PRG CONTACT info).



Option Compare Database

Private Sub Find_Click()
On Error GoTo Err_Find_Click


    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Find_Click:
    Exit Sub

Err_Find_Click:
    MsgBox Err.Description
    Resume Exit_Find_Click
    
End Sub
Private Sub Add_New_Click()
On Error GoTo Err_Add_New_Click


    DoCmd.GoToRecord , , acNewRec

Exit_Add_New_Click:
    Exit Sub

Err_Add_New_Click:
    MsgBox Err.Description
    Resume Exit_Add_New_Click
    
End Sub
Private Sub Find_Acronym_Click()
On Error GoTo Err_Find_Acronym_Click


    Screen.PreviousControl.SetFocus
    DoCmd.FindNext

Exit_Find_Acronym_Click:
    Exit Sub

Err_Find_Acronym_Click:
    MsgBox Err.Description
    Resume Exit_Find_Acronym_Click
    
End Sub
Private Sub Acronm_Click()
On Error GoTo Err_Acronm_Click


    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Acronm_Click:
    Exit Sub

Err_Acronm_Click:
    MsgBox Err.Description
    Resume Exit_Acronm_Click
    
End Sub
Private Sub Command276_Click()
On Error GoTo Err_Command276_Click


    Screen.PreviousControl.SetFocus
    DoCmd.FindNext

Exit_Command276_Click:
    Exit Sub

Err_Command276_Click:
    MsgBox Err.Description
    Resume Exit_Command276_Click
    
End Sub

Private Sub PRG_CONTACT_BeforeUpdate(CANCEL As Integer)

End Sub
---------------------------------------------------------------

Private Sub MAIL_CONTACT_BeforeUpdate(CANCEL As Integer)

End Sub

Private Sub PRG_CONTACT_BeforeUpdate(CANCEL As Integer)

End Sub

-- 
Andi


"John W. Vinson" wrote:

> On Tue, 3 Apr 2007 13:48:02 -0700, Andi <Andi@discussions.microsoft.com>
> wrote:
> 
> >Thanks very much for your response -- sorry about the delay in getting back 
> >to you.
> >
> >I tried the code you suggested, but I must be entering it incorrectly.  When 
> >I get to...
> >If IsNull(
> >...that line turns red and displays IsNull(Expression) As Boolean   
> >
> >The first time I completed the code, the program data displayed in the mail 
> >field.  However, when I entered new data in the mail field, it also changed 
> >the program data.
> 
> Please post your actual code, and the actual names of the controls involved.
> 
>              John W. Vinson [MVP]
> 
0
Utf
4/5/2007 1:30:01 PM
Reply:

Similar Artilces:

Duplicates
One worksheet has 600 + lines with a lot of expenses, including SOME of the local expenses. This is a check register.. Another worksheet has 300 + lines with ONLY local expenses. Trying to get ALL expenses together, but eliminating the duplicates from new list. Thinking B2=date. C2=name, E2=amount - - SO B2&C2&E2 on first long worksheet and then the same on short worksheet... Bring BOTH over to new tab and then stuck. Any ideas greatly appreciated, or another better way to attack it. You could use excel filter: Data - Filter - Advanced Filter - Unique records on...

Data validation
Can data validation be set up to accept a 0( (zero) or any whole number between 25,000 and 10,000,000? Or does this have to be controlled with VBA? This needs to work with xll03 and later versions This DV formula should work fine: =AND(ISNUMBER(A2),A2>=25000,A2<=10000000) Joy? hit the YES below -- Max Singapore --- "Brad" wrote: > Can data validation be set up to accept a 0( (zero) or any whole number > between 25,000 and 10,000,000? Or does this have to be controlled with VBA? > > This needs to work with xll03 and later versions > ...

Which Office X 10.1.5 duplicate fonts can be removed from which folders?
Which of these duplicate fonts can be removed from the Applications/Microsoft/Office X/Office/Fonts folder AND/OR the User/nnager/Library/Fonts folder? All of the following are duplicated in the two folders. Two of them, Times New Roman and Verdana, also are in OS 10.3.3/Library/Fonts. Arial Arial Black Century Gothic Comic Sans MS Copperplate Gothic Bold Copperplate Gothic Light Curlz MT Edwardian Script ITC Impact Lucida Handwriting Monotype Sorts Tahoma Times New Roman Verdana Wingdings Respectfully, Norm On Tue, 6 Apr 2004 04:42:59 -0400, Norman R. Nager, Ph.D. wrote (in article <...

Adding and Linking Dates to Another Field
I have two (2) field in my form. Field 1 is called "Date" and field 2 is called "Due Date". I would like the "Due Date" field to automatically add 90 days from the "Date" field and have that updated in the "Due Date" field. I tried using the DateAdd function in the control box and also the default portion of the field. Any help would be appreciated. Thank you, TomP For staters, change the name of the field you call Date. Date is an Access reserved word. Even when enclosing the name in brackets [Date], you can have problems. Wher...

No data in my journal!
I'm new to RMS and have recently installed our first customer with RMS 2.0 So far, we have gotten everything installed working to the customers liking minus a few things here and there. One of these things is that reprinting a receipt or reprinting from the journal doesn't seem to work. It contains no data in the journal to do any kind of reprint. Is this an option i have to enable to retain receipts in the journal? Yes - you need to check mark "journal receipts from this printer" in the receipt printer tab / tabs of your register - in SO manager go to database - regi...

Scatter Chart Data Point Highlighting
I have a scatter chart with smooted lines and no data markers tha represents a (one) mathematical function. Is it possible to highligh (mark) one data point and from that point draw parallel (dashed) line to the x and y axes? By hovering over the chart you can pop up the data values but I wan (if possible) the parrallel lines to better visualize the position o the selected point on the axes -- rvExcelNewTi ----------------------------------------------------------------------- rvExcelNewTip's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1566 View this thread:...

view data from one table update and save to another table
I have a tabl do this without amending te with item data which I sow on a form to create a purchase order, where the item data may require amending before publishing to the supplier. How do I do this without amending original data which for audit purposes must remain as original. "Bloggsy" <Bloggsy@discussions.microsoft.com> wrote in message news:74D11113-3C3F-441F-8031-FA31035ED0B7@microsoft.com... >I have a tabl do this without amending te with item data which I sow on a > form to create a purchase order, where the item data may require amending > before publish...

Print Forms as they Look
I have a custom form that users will need to print the form as it looks, but with the regular print everything is changed to text. I tried XPath but the problem with that is if a machine does not have that dll, the information on the sent form will not appear ...

Clear contents of last two rows of data on sheet
Hi. I'm using v 2003. I need a couple of lines of code that will delete or clear the contents of the last two rows on a sheet that have data in them. In other words, if there are 800 lines of data and I want rows 799 and 800 to be deleted or contents cleared. The number of the last row varies everytime I run the report. Can anyone help? Thanks! Dani Hi Dani, Here are 2 options. See the comments for when to use the option. 'Option 1 Sub DeleteRows1() 'When a specific column will always have data in last row. Dim lastRow As Long With Sheets("S...

XML heading on the Data menu in excel?
Mine is missing on my newly installed copy of MS Office Professional Enterprise Edition 2003. It is also missing the XML Schema tabs in Word! I need to know how i can find XML please help... email me at karenbutterfly@verizon.net thank you Karen If the XML item is missing from the Data toolbar you might try resetting your menus. Select View, Toolbars, Customize. On the Toolbars tab select Worksheet Menu Bar near the end and click Reset. -- Jim "karenButterfly" <karenButterfly@discussions.microsoft.com> wrote in message news:BFEA2D2A-3EB0-45CC-990E-F16BCBD2F965@micro...

Convert calendar data
I am trying to export my calendar data from one program into yahoo. Here is the current format layout in a csv file: Subject, Start Date, Description, Start Time, End Date, End Time. Here is the layout that I need it to be: Subject, Start Date, Start Time, End Date End Time, All day event Description. 1. I need to have the Description field moved to the end of th record. 2. The Description data from the current layout needs to be to be unde the Subject header not the Description. 2. The new All day event field needs to be added and populated wit "FALSE" 3. And I think each data ...

FIELDS NOT EDITABLE!
Hi, I have a problem. I know how to add a field but i dont know how I can make an existing field editable. If you look at a field like 'Price per Unit' in Opportunityproduct. You see that the price in the field can not be changed. There must be a way to change that. I already looked at the properties and i cant find nothing. Can somebody help me with this. S. Oumoulid ...

enter data in cell which will start macro to move data to sheet2
I have two sheets, one sheet has name, score, handicap, net score. I have a macro that I run after I enter the new score and it updates sheet2. I would like to enter data on sheet1 and it auto update on sheet2. The column's are a, b, c, d. I update column b. When it updates it needs to take column (a) name, and column (b) score and update it on sheet2, with the lowest score first. Again I have a macro that I start and update after I've finished entering the scores, just looking for a quicker way to do this. Thank You ...

Duplicate data from field into another field in same form?
Can I duplicate data from one field on a form into another field in the same form? For example: On our exhibitor entry form, the Program Contact info (fields for name, address, phone, fax, email) is entered first. Mail Contact info is often the same, but not always. Is it possible to autopopulate the Mail Contact with the data from the Program Contact, but allow me to enter new data if necessary? If so, can you tell me exactly how? Thanks! -- Andi On Fri, 23 Mar 2007 09:46:24 -0700, Andi <Andi@discussions.microsoft.com> wrote: >Can I duplicate data from one field on a ...

Form
<third attempt to post> Hi! I have radio buttons on my form that sit in table cells with a colored background. From Design Mode, I set the Properties of the button to have a transparent background. This was done using BackStyle set to 0-fmBackStyleTransparent. Everything looks great in Design Mode but when I exit into normal viewing the backgrounds return to white and they overlap my cell borders. Any advice on how to retain the transparent color for my radio buttons? I hope this makes it through. It's my third attempt at posting. :( It did, and so did the firs...

Some questions about crm performanse on large amounts of data
Hi all! Our organization planning to use ms crm solution. We have about 3 000 000 of customers, and we worry about performance on this data. Can anyone of you manage relative amount of information? Where i can read about it? Thank you. On Feb 16, 6:14 am, "Alexandro" <non.alexan...@gmail.com> wrote: > Hi all! Our organization planning to use ms crm solution. We have > about 3 000 000 of customers, and we worry about performance on this > data. Can anyone of you manage relative amount of information? Where i > can read about it? > Thank you. Hi, i m someone wor...

Filtering out Data
Hi i have a spreadsheet, were i want the user to input all data onto the first worksheet. I then want to be able to transfer, certain rows based on set criteria to other worksheets. Is this possible using any excel functions, or does it require me to use macros and or programming Cheers Jo Hi Jo, Use rhe Advanced Filter feature on the Data menu. Debra Dalgleish has an excellent tutorial on Advanced Filter at: http://www.contextures.com/xladvfilter01.html Note particularly, Debra's instructions for 'Extractng data to another worksheet' --- Regards, Norman &qu...

Receiving duplicate emails
I have just recently created my email account in Microsoft Outlook and now when I receive email I get the same one 15 times (and that is no stretch!) Is there something I have done wrong? How do I fix this?! Thanks What version of Outlook do you have? What sort of mail account(s)? Do you only get a single message many times, or all the messages many times? -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Carrie" <cadelaney@rogers.com> wrote in message news:0a0e01c3afaf$f8efab60$a001280a@phx.g...

group & summarize diff rows of data that have something in common
I am trying to arrange a large amount of data (inventory) in 2 different ways. 1) Group all identical parts into one row and 2) Group all identical locations into one row. I dont know how to do this. I am dealing with over 3,000 rows. Any suggestions? Depending on your workbook layout, you may be able to use a pivot table to summarize the data. There are instructions in Excel's Help, and Jon Peltier has information and links: http://peltiertech.com/Excel/Pivots/pivotstart.htm pkunAAC wrote: > I am trying to arrange a large amount of data (inventory) in 2 different &g...

Changing the names of fields in tables after creating other object
I just leaned about the naming conventions after I have created my tables, reports and several queries. Can I change the name of fields in my tables (to remove the spaces and give them unique names ie not just last name but childlastname) without destroying the work I have done in queries, reports, and forms. Mary -- Positive Direction for Youth & Families, Inc. (www.pdfyinc.com) Possibly. If you are using a newer version of Access, say 2003 or 2007 AND you have Name Autocorrect, and all it's options, enabled, it MIGHT work. I found it somewhat buggy. Before you...

Update and insert a Date into a field in sql
Hi, I have the following sql statement. 'now set follow up strsql1 = "UPDATE tblCustomerContacts " & _ " SET [Follow_Up] = " & Me![Follow_Up] & _ " WHERE [LineID] = " & Me!Customer_Contact_LineID 'Quotes this way as feild is numeric Debug.Print strsql Where Me![Follow_Up] is a date - short date The field that is being updated is also a date feild In the current format 25/06/2010 (25 June 2010) results in 30/12/1899 ummmmmmmmmmmmmmmmmmm?????????????? What is the cor...

Retrieve email from another computer
My husbands computer in office is down, he wants to retrieve his emails from home. How can I do this quickly? Tks That depends on the type of mail system they use at work (server based postoffice, or Internet mail, or what). Can you give us some more information? -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:0f9a01c3dfb1$12f44670$a101280a@phx.gbl, maureen.krychkowski@verizon.net wrote: > My husbands computer in office is down, he wants to > retrieve...

Sort column containing different data types
Can anyone help, I have a column with project codes in the following format 123 146/5 1246 1344 102/3 Is there any way to sort the column by the numeric values to the left of the character symbol only, so that it reads: 102/3 and not 123 result with normal sort 123 102/3 146/5 1246 1246 1344 1344 146/5 Is there any way round this other than separating the code into separate columns ?? p, My Excel add-in Special Sort will sort by the first group (or last group) of numbers in the cell entry. It sorted your numbers as follows... 102/3 123 1...

ACC2007: SubForm slows down form
Hello, i have a form which is connected to a query with about 6000 records on sql server. If i open that form, it is really fast. But If i add an empty subform on this form, the form opens in 12 sec. What i've seen is, that without the subform the record counter on the bottom only shows the current record but with a subform on it, it seems that it loops through all records and the shows "1 of 6000". Any ideas why there is a difference? I also tried to make the subform invisible or disable it, but the behaviour is the same. Regards Andi ...

Default field setting for cross tabs
Hi group, I am trying to figure something out for a friend. He is coding in VB and creating cross tabs. I'm not sure of the specifics, but when he pulls in a new field into the cross tab the default field setting is always "Count". However, it seems as if the field name begins with "TOTAL" it defaults to "Sum". Is that true? Is there a way to always set the default so that it is "Sum" instead of "Count"? Thanks!! - S If there's any non-numeric cells in that column (including text and empty cells), then you'll get Count. If...