-
Updated Record Field has Wrong Data on Subsequent SELECT
I have a record that I'm UPDATING like so:
num = 9
cmdTypeUpdate = "UPDATE [Classes] SET [Type] = '2', [Legal Duration] = '" & num & "' WHERE [ID] = '" & cmb.ListIndex & "'
cn.execute (cmdTypeUpdate)
That works - it updates the record with the appropriate values.
However, the macro then goes on to refresh a listbox with a SELECT statement, like so:
lstSELECT = "SELECT [ClassNm], [Legal Duration], [Policy Duration] FROM [Classes]"
and the value for myrecordset.fields(1) is not 9, but is always 0. If I stop/reset the macro, then the SELECT statement works fine retrieving 9 from the field in the database.
Any ideas what may be going on here? Thank you.
-
Well, I can't figure this behavior out, but I found a work-around which is to Unload the UserForm and then call it again. This works but it's not optimal since the UserForm flickers. But, I don't have any other solutions.
-
You can use
me.requery
to update the form or
me.listboxnamehere.requery
to upate just the list box.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules