ScottyJones
New member
- Local time
- Today, 02:01
- Joined
- Aug 8, 2018
- Messages
- 7
Hi all,
So I have a query of a table that has data that is imported from an external system. This table has a Primary Key that is also imported from the other system. (so I can update it to whatever I want)
From the query I am displaying a form that has the few records of that query. At times I need to copy a record and add it the same table (display in the same form just like Copy / Paste but I want to be able to change 2 fields the PK called "Barcode" and another one called "TB Pallet". All I need to do is update both fields by appending an "A" at the back of them, but I want to be able to do this during the copy/paste function.
This is what I have so far:
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.RunCommand acCmdRecordsGoToNew
.RunCommand acCmdSelectRecord
.RunCommand acCmdPaste
End With
' If I end it here, it runs fine and does exactly what I want, but I don't want the user to have to remember to update the 2 fields'
Set [TB Pallet] = [TB Pallet] & "A"
Set [Barcode] = [Barcode] & "A"
'This fails with "Compile error: Invalid use of property"'
I guess I am not calling the field correctly or it could be that the paste function already violated the Primary Key so it won't change focus to update the fields..... ???
Any help would be appreciated..
Scott
So I have a query of a table that has data that is imported from an external system. This table has a Primary Key that is also imported from the other system. (so I can update it to whatever I want)
From the query I am displaying a form that has the few records of that query. At times I need to copy a record and add it the same table (display in the same form just like Copy / Paste but I want to be able to change 2 fields the PK called "Barcode" and another one called "TB Pallet". All I need to do is update both fields by appending an "A" at the back of them, but I want to be able to do this during the copy/paste function.
This is what I have so far:
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.RunCommand acCmdRecordsGoToNew
.RunCommand acCmdSelectRecord
.RunCommand acCmdPaste
End With
' If I end it here, it runs fine and does exactly what I want, but I don't want the user to have to remember to update the 2 fields'
Set [TB Pallet] = [TB Pallet] & "A"
Set [Barcode] = [Barcode] & "A"
'This fails with "Compile error: Invalid use of property"'
I guess I am not calling the field correctly or it could be that the paste function already violated the Primary Key so it won't change focus to update the fields..... ???
Any help would be appreciated..
Scott