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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy and delete information from a form

Status
Not open for further replies.

JillianM

Technical User
Jun 10, 2010
23
US
Ok, so I know this isn't the right way to do things, but I want to do it anyway...lol. It seems like it should be easy but I can't figure out how to make it work. I want to create a button that duplicates the current record, deletes the data from the DateofVisit and Notes fields and then highlights those fields for entry. I can copy the record, but how do I delete the data from the fields? I could use conditional formatting to highlight the fields if they were blank but I can't figure out how to get them to go blank. I hope this makes some kind of sense and that one of you takes pity on me. Sorry for being such a goober!
 
This sample uses the ill-advised Code that the Access Command Button Wizard uses to create a 'Duplicate Record' Button (in Red), then sets your two Controls to Null. Presumably you can use Conditional Formatting to highlight the Controls as you've already suggested:

Code:
Private Sub cmdCopyRecordDeleteFields_Click()
 On Error GoTo Err_cmdCopyRecordDeleteFields_Click


    [COLOR=Red][b]DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append[/b][/color]
    
    [COLOR=blue][b]Me.DateOfVisit = Null
    Me.Notes = Null[/b][/color]

Exit_cmdCopyRecordDeleteFields_Click:
    Exit Sub

Err_cmdCopyRecordDeleteFields_Click:
    MsgBox Err.Description
    Resume Exit_cmdCopyRecordDeleteFields_Click

End Sub
Linq ;0)>


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Make sure that the 'Append' in the

'Paste Append

comment gets on the same line as the 'Paste,' in your actual Code.

L

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top