Macro cannot run more than 19 times (1 Viewer)

aanders

Registered User.
Local time
Yesterday, 22:27
Joined
Sep 5, 2013
Messages
30
First of all, i am a real newbie on Access and English is not my mother tounge so i apologize if something is unclear.

Background:
I have a form where you can edit the content of a table. This form has a onchange macro connected to it. The macro adds a value to a column in the table (if onChange set Uppdated=yes). I only want to run this macro one time but since its onchange it loops and i get the message "You can only call the macro 19 times..." (or something similar, i translated it from Swedish to English).

Question:
How do make the macro run just 1 time?
 

Some

Registered User.
Local time
Today, 06:27
Joined
Aug 27, 2013
Messages
18
Hi aanders;

I'm not entirely sure how you could do this without using any vba.

I guess you could have a temp variable of invisible text box on the form that changes once the table has been updated and then have an if statement along the lines of:


Code:
If TXT_Check >0 Then 
 
'Do nothing 
 
Else:
 
'Do Append Query 
'Set Value TXT_Check = "1" 
 
End If

Not the best way to do it I'm sure but thats what comes off the top of my head.

-Some
 

aanders

Registered User.
Local time
Yesterday, 22:27
Joined
Sep 5, 2013
Messages
30
Hi!

Thnx for the reply. I tried your solution but i still get the same message.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 06:27
Joined
Feb 19, 2013
Messages
16,668
try the following in the before update event of the form

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.Updated=True

End Sub

You need to remove your macro and me.updated needs to be a field you have brought through in the recordsource for your form
 

Users who are viewing this thread

Top Bottom