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

UGH! Frustrating field update "crash" after record copy

Status
Not open for further replies.

ag90fox

IS-IT--Management
Mar 14, 2002
17
0
0
US
I'll try to make this brief for those kind souls that will help me! I'm not an elegant programmer, so please forgive the horrible syntax/grammar/etc.....

2. Scenario: I have an order form for a service. If the service isn't completed satisfactorily, the customer can resubmit the order by pressing a 'Resubmit' button (code below), which SHOULD 1. create a copy of the current service request, 2. clear & change certain fields on the form, and 3. send an email to the individual who has to take action on the request.

3. Problem: Copying the record as a standalone set of code works fine! Sending the email as a standalone code works fine, BUT when I add in the code to set the hoursbilled to zero, and copy the variable 'groupid' to the deliverable group, the entire subroutine doesn't function when the button is pressed on the form. No new record, no email, nuthin! I'm sure this is a no-brainer to most, but its got me stumped! How do I set these fields to the required values? HELP!:eek:)

Private Sub cmdResub_Click()

Dim groupid As Double
groupid = Me.[DeliverableID] 'copy current record ID for new record group

DoCmd.DoMenuItem acFormBar, acEditMenu, acSelectRecord, , acMenuVer70 'select current reocrd
DoCmd.DoMenuItem acFormBar, acEditMenu, acCopy, , acMenuVer70 'copy current record
DoCmd.GoToRecord , , acNewRec ' create new record
DoCmd.DoMenuItem acFormBar, acEditMenu, 3, , acMenuVer70 'past data into new record
DoCmd.GoToRecord , , acLast 'ensure the new record is current

Me.HoursBilled = 0
Me.DeliverableIDGroup = groupid



DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord
Dim OPRAddress, OPRAddress2, OPRAddress3 As String
OPRAddress = ' recipient
DoCmd.SendObject acSendReport, "rpt_snapshot_mailout", etc..

End Sub


Thanks for your consideration of this problem that has cost me close to 3 hours of my life so far trying to solve!
 
The DeliverableIDGroup thingie - would it be a primary key, or something? If so, it is a very bad idea using Double as datatype ... Should it be that the field the control is bound to, is long integer, I'd try also declaring the groupid variable as Long - and, for safety, use a naming convention on it

[tt]dim lngGroupID as long[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top