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

Copy record button does not copy all data

Status
Not open for further replies.

gbankos

MIS
Jun 19, 2008
9
US
I inherited and am making alterations to an access db that stores prospect bidding information. All of the bidding data is stored all in 1 main table, with supporting tables to hold predefined values for columns in the main table, basically foreign key type stuff. There is a form set up to enter/edit/delete data in the main table and there is a copy button on the bottom of form that takes the existing record and pastes it as a new record. This is the code behind the on click event for that copy button:

Private Sub cmdCopy_Click()
Dim lngID As Long

On Error GoTo Err_cmdCopy_Click

DoCmd.Hourglass True

' prompt user for confirmation
msg = MsgBox("Are you sure you want " & _
"to create a copy of this record?", vbQuestion + vbYesNo)
If msg = vbNo Then
GoTo Exit_cmdCopy_Click:
End If

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

' prompt the user to view the record
msg = MsgBox("Do you wish to view this record?", vbQuestion + vbYesNo)
If msg = vbYes Then
' retrieve the last id number of the record which is
' the newly created record
lngID = DMax("[ID]", "[" & ACTIVE_BIDS_QUERY & "]")

' adjust the recordsource accordingly
Me.RecordSource = "Select * from [" & _
ACTIVE_BIDS_QUERY & "] Where [ID]=" & lngID
End If

Exit_cmdCopy_Click:
DoCmd.Hourglass False
Exit Sub

Err_cmdCopy_Click:
MsgBox Err.Description, vbCritical
Resume Exit_cmdCopy_Click

End Sub

What I am finding is that since I added a bunch of fields to the form, this copy function is not filling in the data that is on the bottom portion of the form for the new record. What I mean is simply that it is leaving blank whatever the last 15 or so fields are on that form. If I move a field on the bottom of the form to the top, the new record has data in that field.

Now, if I paste the data into an excel worksheet, the data shows fine. So is there a paste limit specifically in Access that I don't know of? I searched and I couldn't find anything. I thank you for your time in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top