Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy form data into another record 1

Status
Not open for further replies.

annie52

Technical User
Mar 13, 2009
164
US
The AceMan1 partially addressed this issue at thread702-1014371. I'd like to have two buttons. One that allows the user to copy the current (saved) record (discussed by AceMan1) and another to repeat that copied information into a new record on the form. I'm still playing with the first part but don't have a clue how to even start on the second part.
 
How are ya annie52 . . .

You should understand better the [blue]Default Value[/blue] property of a control before you continue. To read about it:
[ol][li]Open a form in design view.[/li]
[li]Call up the properties window and select the [blue]Data[/blue] tab.[/li]
[li]Select a textbox, then put the cursor on the [blue]Default Value[/blue] property line and hit F1.[/li][/ol]

Next see my post in thread702-1382356 to get the idea ...

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi TheAceMan1. I didn't read any new information about defaults in the Help system. Did I miss something? Was there something specific you wanted to bring to my attention?

Maybe I need another cup of coffee... I didn't see anything about repeating (pasting) in the thread you offered.

I knew about the Ctrl + ' shortcut but that isn't good for me because I want to "remember" and repeat the values of all but one of the controls on the main form. The controls include textboxes, combo boxes, check boxes, a hyperlink, and an unbound calculated textbox. Access Help says the tag property works with all these controls and I do see it in the Immediate window. I just can't figure out how to paste into a new record.
 
annie52 said:
[blue] ... I want to "remember" and repeat the values of all but one of the controls on the main form.[/blue]
If you write the values of the selected record to their respective default value property, [blue]these values will be retained and posted[/blue] for each new record. Does this not take care of the copy and retention?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
You are an absolute genius! My problem was that I included quotes around the question mark ("?") in the Tag property. Your solution is perfect. Thank you!
 
annie52 . . .

Here's an exxample try the following:
[ol][li]In design view, add a question mark [blue]?[/blue] ([red]no quotations please![/red]) to the Tag property of the controls of interest. Leave out the unbound control.[/li]
[li]The button code will be:
Code:
[blue]   Dim ctl As Control, DQ As String
   
   DQ = """"
   
   For Each ctl In Me.Controls
      If ctl.Tag = "?" Then
         ctl.DefaultValue = DQ & ctl & DQ
      End If
   Next[/blue]
[/li][/ol]
Thats it!

Your Thoughts? . . .

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 

Glad we could help! [thumbsup2]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top