troubleshooting Question

clearing form except for certain fields

Avatar of JARICHARDUSA
JARICHARDUSAFlag for United States of America asked on
Microsoft AccessVB Script
9 Comments1 Solution680 ViewsLast Modified:
This is what I'm trying to do.

I have a form in which a user enters all information for a part in order to add this part into a database.  If however the user has multiple numbers of the same part, instead of recreating everything from scratch, I want it so that the user just has to click a "save and duplicate" button in which case the data they just entered will be saved as a record in the database and then the form will requery but maintain the information incertain fields such as part name, NSN, ect. (basically the fields that will not change at all for that particular part) and the other fields will be empty for entering the new information such as Serial Number and such.  The following is the code I currently have on that button:

Private Sub Command92_Click()
On Error GoTo Err_Command92_Click
DoCmd.RunCommand acCmdSaveRecord


    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Me.Base = ""
Me.Building = ""
Me.txtHRDate = ""
Me.txtComments = ""
Me.txtContactNumber = ""
Me.txtHRTo = ""
Me.txtHRDueDate = ""

Exit_Command92_Click:
    Exit Sub

Err_Command92_Click:
    MsgBox Err.Description
    Resume Exit_Command92_Click
   
End Sub

This, however, is giving me an error:  "object does not support this property or method"
The record is being saved to the database, though, its just giving me the above error and then not clearing out the fields I'd like cleared prior to creating a new record.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros