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

Access - Step Through of code works - Run through doesn't

Status
Not open for further replies.

Kenton

Technical User
May 7, 2002
30
AU
Gudday

I am calling a form from another form in Access and trying to populate a couple of fields on the second form from the first.

The problem is, the second field doesn't get populated except when stepping through the code!?!?

viz:
stDocName = "Actions"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , stDocName, acNewRec
Forms("Actions").Cams_ID = Forms("faults").[CamsNumberText]
Forms("Actions").old_sts_id = Forms("faults").[Status_id]

4th line (Cams_ID) works, 5th line doesn't when run through.
BUT Both lines work fine when stepped through.

Any ideas?
Kenton
 
Just a guess, but it might have to do with the speed of execution. I mean when you are stepping through the 4th line then database has time to update itself (looks like you are adding a new record, this takes more time than an update). When you are running the code it may not have the time it needs and the 5th line fails. You may need to add something like a doevents or use the beforeinsert or afterinsert events.

Thanks and Good Luck!

zemp
 
Thanks

I found it.

It seems the screen wasn't being refreshed. If I dragged a window across the field the data would appear.

Kenton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top