DoCmd or RunCommand

L

Lena

I have a DB that we use for equipment inventory and surplusing. When a piece
of equipment has been surplused it must be moved to a table called
tblSurplused. The information remains in the "active" portion of the DB as
the user name and location may not change, this allows for adding only the
new equipment information without asking the data entry operators to rekey
all the user information plus the equipment info. Here's the setup. I have
a main and a subform. The main has the user location/address, the sub has
user name, equipment name, serial number, etc. I have the main and the sub
linked by the location ID, so far so good. The subform is in datasheet view
to make for easier reading and column arranging for the ops. I placed a
check box on the screen called SURPLUSED. When this box is checked I asked
for the following to take place:


Private Sub SURPLUSED_AfterUpdate()
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.OpenTable "Surplus tbl", acNormal
DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
DoCmd.Close
Me.SURPLUSED = "False"
End Sub

The Me.SURPLUSED = "False" unchecks the SURPLUSED BOX in the active subform
and prepares it for the next time a user has updated equipment assigned. The
code works perfectly, except the data from the selected record does not copy
over to the table.

I have tried to copy to the subform, no luck. I then decided to go directly
to the table and paste the data. Everything works, except no data has been
pasted in the table. Where am I going wrong? I know it's something that's
staring me in the face and I'm just missing it. Would appreciate any
help/input.
 
N

NetworkTrade

if copy/paste of a single record does not work then one possibility is that
the layout of the 2 tables are not exactly equal. Another possibility is
that you are including the autonumber field which won't work....be sure to
leave that out of the copy/paste
 
L

Lena

Thank you so much. I found out exactly that after the fact. There was a
field missing. I made an exact copy of the table fields in the subform and
the record went over. Thanks for your response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top