copying specific record fields to a new record

J

Jae Hood

Would it be possible to have a button on my order form which copies whichever
record the form is currently on to a new record.
For example a new order similar to an old order would be created, all that
would be different is the orderID and the quantity etc...

Thanks!
 
O

Ofer

Try this code when you click the button
' To copy the current record to a new record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
' To remove the values from certain fields
Me.Quantity= 0
Me.Price = 0
 
J

Jae Hood

The only field that doesnt allow duplicates on this form is OrderID so i put
Me.OrderID=00000-1

When i click it it gives me a run time error and asks me to debug the sub
for my combo box that looks up records based on the OrderID.
Could this be causing a conflict?
 
O

Ofer

Can you post the code you created, the type of OrderID field, point the line
where you got the error message.
 
J

Jae Hood

Here is the code:
' To copy the current record to a new record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
' To remove the values from certain fields
Me.OrderID = 0

The orderid field is a text field

Line to debug:
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Now when I click the button it says the action copy isn't available and
points to the 2nd line of actual code.

Thanks for the follow-up!
 
O

Ofer

First if the OrderId string type then assign string to it
Me.OrderID = "0"

Now, when you start a new record, what kind of a value you assign to the
OrderId.
What is the default, if there is one.
Try and assign the same value to the Order id
 
J

Jae Hood

I did those changes.
Still sending me to the pub for my combo box asking me to change:
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
 
O

Ofer

It's look that there is more to your code in the form, and it's hard without
seeing the all picture.
If you want to post the mdb, ziped to my Email and I'll look at it.
[email protected]

change the mdb name from MDBName.mdb to MDName.Jpg other wise hotmail will
block it.
 
Top