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

GoToRecord , , acNewRec - STOPS WORKING

Status
Not open for further replies.

grobermatic

Technical User
Dec 21, 2002
153
GB
Hi all,

I have code which does custom data validation on my form, it then interacts with another program (Attachmate EXTRA! Personal Client) before moving to a new record on the form.

'--- Data Validation Code ---

' XXXXXXXXXXXXXXXXXXXXXXXXXX

'--- Data Validation Code ---

'AUTO NOTE Account
If MsgBox("Do you want to automatically note EVT1 and the Scratchpad?", vbQuestion + vbYesNo, "Note Account?") = vbYes Then

If Me.Payment_Info_AccNumber = ExCap("accnumber") Then

Note_EVT "OPPP", 4, Me.[Card Types] & " payment for " & Format(Me.Amount, "Currency") & " (AUTO-NOTE)"
Note_Scratchpad Me.[Card Types] & " " & Format(Me.Amount, "Currency") & " " & Date

dteHoldUntil = Date + 7
Add_LetterHold dteHoldUntil

Else
MsgBox "The AutoNotes could not be actioned because this account is no longer active on EXTRA!", vbExclamation, "AutoNote"
End If

Else
End If

'Reset form for new record

'Reset account number to Enabled
Me.Payment_Info_AccNumber.Enabled = True
Me.lblAccProt.Visible = False 'Make message invisible

DoCmd.GoToRecord , , acNewRec
Set_User_and_Date
Me.Payment_Info_AccNumber.SetFocus
Me.imgDelta.Visible = False
Me.imgSolo.Visible = False
Me.imgSwitch.Visible = False

The code works fine when I comment out the AUTONOTE Account section, but when I add it back in the code seems to pause when it gets to DoCmd.GoToRecord , , acNewRec. The strange thing is when I step through the code it seems to move on to theis line with no errors or problems.

Any ideas what could be stopping my code?

I can post more code if necessary for the Sub Procedures that I call in the above code.

Regards

Craig

--------------------------------------------------------------------------------------------------------
"Time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: Women!" .. Dr E. Brown (1985)
 
A bit of playing around and I seem to have sorted it ...

I think one of the subprocedure was taking the focus away from the form somehow so when I tried to use the line :
DoCmd.GoToRecord , , acNewRec, it wasn't being called on the form I wanted... although I don't know where it WAS being called???

Instead I used the following to correct the problem :
DoCmd.GoToRecord acDataForm, "frmPaymentEntry", acNewRec

Thanks anyway anyone who was considering answering

Craig

--------------------------------------------------------------------------------------------------------
"Time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: Women!" .. Dr E. Brown (1985)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top