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

Nulling a field after copy 1

Status
Not open for further replies.

Serpno11

Programmer
Jul 11, 2001
6
0
0
US
I am not a VB jock, but have used a wizard to generate code to copy the current record. Now I have the requirement to blank out a field on the new record, and since it's a required field, the user will be prompted to consciously populate this field.

I'm looking for some simple code to pull this off that I can add to the "Copy a record" section of code. Here's the code the wizard generated. I realize it's ugly, but i was hoping someone could include how and where to insert the additional code as well as the lines of code themselves:

Private Sub Copy_BR_Button_Click()
On Error GoTo Err_Copy_BR_Button_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Copy_BR_Button_Click:
Exit Sub

Err_Copy_BR_Button_Click:
MsgBox Err.Description
Resume Exit_Copy_BR_Button_Click

End Sub


Thanks for any help!!
 
Private Sub Copy_BR_Button_Click()
On Error GoTo Err_Copy_BR_Button_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, ,
acMenuVer70 'Paste Append

Hope that this can help...
Name of text box.value = "" or "0"
This would make the text boxes be null or zero after you copied it...

Inform me if it works....

Exit_Copy_BR_Button_Click:
Exit Sub

Err_Copy_BR_Button_Click:
MsgBox Err.Description
Resume Exit_Copy_BR_Button_Click

End Sub
 
Asiandoll,

Thanks for the help!! Now I have to choose between it being a required field, and nulling it out, because I can't do both. Nor can I set up a validation rule. Copy goes forward but doesn't change the field.

Thanks again!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top