From: Allen Browne on
What happens when you step through the code? Does the table change?

Either it's not executing to completion, or something else is changing it
back later.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"PW" <emailaddyinsig(a)ifIremember.com> wrote in message
news:sp3nl59ob2is9vasfnv2ia32p21e3g8j5c(a)4ax.com...
> On Sat, 23 Jan 2010 17:06:26 +0800, "Allen Browne"
> <AllenBrowne(a)SeeSig.invalid> wrote:
>
>>You can debug the code, adding Debug.Print right below the line that
>>executes the change, to verify it is made.
>>
>>If it is, but the table is later unchanged, you may have something (bound
>>form?) changing it back.
>
> I thought about that but....
>
> It executes the line that updates the record. I see it in debug. But
> the changes are not actually saved to the table. However, when I
> execute the routine from a command button the change gets saved to the
> table. Must be something funky with the after update event of a
> combobox or something.
>
> The bound table of the form is the work file, not
> tblObjectPermissions.
>
> Thanks
>
> -paul

From: PW on
On Sun, 24 Jan 2010 08:14:47 +0800, "Allen Browne"
<AllenBrowne(a)SeeSig.invalid> wrote:

>What happens when you step through the code? Does the table change?

Not when I execute PopPermissions() from the AfterUpdate of the
combobox. It does when I do the same in the Save button.

>
>Either it's not executing to completion, or something else is changing it
>back later.

I commented all code after PopPermissions in the AfterUpdate and no
change. All I am doing in the command button (same as I tried in the
combobox afterupdate) is:

Private Sub cmdSave_Click()
'First Save a Record to the tblMenuPermWorkF, just in case
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70

PopPermissions

End Sub

I just searched for "code in access 2003 afterupdate event will not
save changes to a table" and you came up #2!!! :-)

-paul
From: PW on
On Sun, 24 Jan 2010 08:14:47 +0800, "Allen Browne"
<AllenBrowne(a)SeeSig.invalid> wrote:

>What happens when you step through the code? Does the table change?
>
>Either it's not executing to completion, or something else is changing it
>back later.


If I can send you a screen print proving that the line of code
actually gets highlighted in debug and a pic of the table before and
after the AfterUpdate event and the Save button, let me know!

I think I have had these issues in the past with Access but maybe it's
my imagination!

Thanks,

-paul
From: PW on
On Sun, 24 Jan 2010 08:14:47 +0800, "Allen Browne"
<AllenBrowne(a)SeeSig.invalid> wrote:

>What happens when you step through the code? Does the table change?
>
>Either it's not executing to completion, or something else is changing it
>back later.


I am famous <BG>!

http://www.groupsrv.com/computers/about657995.html

That didn't take long!

I have no idea how this stuff works!

-pw
From: Allen Browne on
Sounds like you are not clear on how to verify the update is actually
happening.

Immediately after the Update row in your code, add some Debug.Print
statements to indicate what's happened, e.g.:


If rstObjPerms.NoMatch Then
rstObjPerms.addnew
rstObjPerms!ObjectName = strObjectName
rstObjPerms!GroupName = strGroupName
rstObjPerms!ObjectType = "M"
rstObjPerms.Update
rstObjPerms.Bookmark = rstObjPerms.LastModified

Debug.Print "rstObjPerms.Update executed at " & Now() & _
" creating record " & rstObjPerms![YourPrimaryKeyNameHere] & _
". " Error was " & Err.Number
Debug.Print "Verifying it made it into the table: " & DLookup("...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"PW" <emailaddyinsig(a)ifIremember.com> wrote in message
news:k7jnl55sv1p4p329d7hus09fvn051dp1lp(a)4ax.com...
> On Sun, 24 Jan 2010 08:14:47 +0800, "Allen Browne"
> <AllenBrowne(a)SeeSig.invalid> wrote:
>
>>What happens when you step through the code? Does the table change?
>>
>>Either it's not executing to completion, or something else is changing it
>>back later.
>
>
> If I can send you a screen print proving that the line of code
> actually gets highlighted in debug and a pic of the table before and
> after the AfterUpdate event and the Save button, let me know!
>
> I think I have had these issues in the past with Access but maybe it's
> my imagination!
>
> Thanks,
>
> -paul