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!

Error when changing subform's container source objects too quickly

Status
Not open for further replies.

inso18

Technical User
Dec 30, 2006
147
IL
Hi Everyone.

I have a subform container (sfrmGroups) with a frame buttons above it. Each button loads a different source object for the container. Also each time a new source object loads, the following VBA code is being performed:

Code:
Do While rs.EOF = False
   If rs!GroupId = lngGroupId Then
       Me.sfrmGroups.SetFocus
       DoCmd.GotoRecord , , acGoTo, rs.AbsolutePosition + 1
   End If
   rs.MoveNext
Loop
rs!GroupId = lngGroupId

If I switch between the source objects too quickly, I get the following error:

"The macro or function set to BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field"

My BeforeUpdate and ValidationRule values on each control of the source objects are clear.

Is there anyway to bypass this error (that only occurs when I quickly change between source objects)? Is there a way to make Access first finish the source objects change, and only then to do other actions? (DoEvents doesn't help here)

Thanks much.
 
DoEvents will only relinquish control to the operating system .. in this case after the loop has finished. How about disabling the other buttons while your code is executing? then re enable them after is is done

me.YourToggleButtonNameHere.enabled = False

:)


Remember amateurs built the ark - professionals built the Titanic

[flush]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top