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!

Runtime errors

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
All client systems are running access runtime to access this database and random runtime errors are being reported. There is no runtime error number just the error.

It seems to only happen when a user clicks on a button that is meant to copy the data that is in a field and it also writes back to the database what "policy" was used. The code behind the button is below and i was wondering if anyone might be able to see any problem with the code possibly causing the issue, again it is random and does not happen all the time. Any suggestions are welcome!

Code:
Private Sub copybutton_Click()

If choose.Value = "Sooner date was available" Then editnotes1.SetFocus
If choose.Value = "sooner date was not available" Then editnotes2.SetFocus
RunCommand acCmdCopy
editnotes1 = Notes1.Value
editnotes2 = Notes2.Value
'saves username, date and saves what policy was used
Forms!pp_chooser!frmUsage!username = fOSUserName()
Forms!pp_chooser!frmUsage!userdate = Now()
Forms!pp_chooser!frmUsage!Policy = "Sooner Dates"
Forms!pp_chooser!frmUsage.SetFocus
Forms!pp_chooser!frmUsage.SourceObject = ""
Forms!pp_chooser!frmUsage.SourceObject = "frmusage"
 DoCmd.GoToRecord , , acNewRec
'end 'saves username, date and saves what policy was used

End Sub

Thanks in advance for any help with this!

Paul
 
You may try this:
Forms!pp_chooser!frmUsage[!].Form[/!]!username = fOSUserName()
Forms!pp_chooser!frmUsage[!].Form[/!]!userdate = Now()
Forms!pp_chooser!frmUsage[!].Form[/!]!Policy = "Sooner Dates"

Anyway, why do you change the SourceObject ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, thank you for the response, if i change what you suggested the data would not be written to the subform "frmusage". Am i not understanding what you are suggesting?

To be honest I'm not sure why i was changing the source object from there. Thanks for point that out as i am going to remove that from the code. Maybe this is causing the intermittent error?

Paul
 
Sorry PHV, I should probably learn how to read before I respond. I misread your suggestion.

Thanks again!

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top