I recently upgraded from Office 2003 to 2016. My record set macros are not compiling. The Edit command is being flagged as an error. What needs to be changed?
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
VBA in Office 2016 vs Office 2003
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » VBA in Office 2016 vs Office 2003
- This topic has 10 replies, 4 voices, and was last updated 8 years, 3 months ago.
AuthorTopicWSbluegoose1776
AskWoody LoungerJanuary 13, 2017 at 9:54 am #507958Viewing 5 reply threadsAuthorReplies-
Andrew Lockton
AskWoody_MVP -
WSbluegoose1776
AskWoody LoungerJanuary 16, 2017 at 8:25 am #1588970This is the code that is getting an error. It is the .Edit command that is flagged. Attached is a snapshot of the references. None show as missing.
Function fSetMDBName()
‘See Sub fSetCMLogName()
On Error GoTo fSetMDBName_Err
Dim vLogName As Variant
Dim vMDBName As Variant
Dim mydb As Database
Dim rst As Recordset
Dim strTitle As StringgvCMLogName = gvTgtDBName
‘DoCmd.Hourglass True
Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset(“tbl_Sys”)rst.MoveFirst
rst.Edit
rst![MDB_Name] = gSysData.TgtFileName
rst![Source Path] = gSysData.TgtPath
rst![File Name] = gSysData.TgtFullFileName
rst![FullPathName] = gSysData.TgtDB
rst![TgtName] = gSysData.TgtFileName
rst![Updated] = Now()
rst.Update
vMDBName = rst![MDB_Name]Debug.Print rst![Updated], rst![TgtName], rst![FullPathName], rst![File Name], rst![Source Path]
‘ rst.Close
DoCmd.Hourglass FalseSet rst = Nothing
Set mydb = Nothing‘ Set mydb = CurrentDb()
‘ Set rst = mydb.OpenRecordset(“tbl_Sys”)
‘ rst.MoveFirst
‘ Debug.Print rst![Updated], rst![TgtName], rst![FullPathName], rst![File Name], rst![Source Path]
‘ rst.Close
‘ Set rst = Nothing
‘ Set mydb = NothinggvTgtDBName = vMDBName
strTitle = vMDBName
Call fSetDatabaseTitle(strTitle)gvMDBName = vMDBName
fSetMDBName = vMDBName
‘9/12/2002
DoCmd.Maximize
strForm = “frm CII_Menu”
‘Call fCloseForm(strForm)
‘DoCmd.OpenForm strForm, acNormal, “”, “”, , acNormalfSetMDBName_Exit:
Exit FunctionfSetMDBName_Err:
MsgBox Error$
Resume fSetMDBName_ExitEnd Function
-
Andrew Lockton
AskWoody_MVPJanuary 16, 2017 at 11:41 pm #1589057Are you sure you have exclusive access to the database table? It sounds like this is a system table and you may not actually be allowed to edit the table via code.
If this code worked in Access 2013 then it might be related to the format of the DB. Is the format upgraded to 2016 or is there a compatibility mode for using a 2013 version in 2016?
access-mdb
AskWoody MVPJanuary 17, 2017 at 5:01 am #1589067Andrew, as far as I’m aware system tables start MSys, not tbl. And his database was 2003 not 2013.
Bluegoose, I can’t see any significant difference between your script and my ones (and mine have been converted from 2003 to 2016 via 2013). Are there any error codes or messages? Is it failing to compile or does it fail when run?
Eliminate spare time: start programming PowerShell
-
WSbluegoose1776
AskWoody Lounger
WSrory
AskWoody Lounger-
WSbluegoose1776
AskWoody Lounger -
WSbluegoose1776
AskWoody LoungerJanuary 20, 2017 at 10:54 am #1589393I am having another compile problem with the following code:
Sub sTableAndFieldList()
On Error GoTo E_Handle
Dim strMsg As String
Dim str1 As String
Dim str2 As String‘ Application.ScreenUpdating = False
Dim obj As AccessObject
Dim obj2 As AccessObject
Dim dbs As Object
Dim db1 As Database
Dim tdf1 As TableDef
Dim idx As Index
Dim fld1 As Fieldstr1 = “”
Set dbs = Application.CurrentData
Set db1 = CurrentDb‘ Search for open AccessObject objects in AllTables collection.
For Each tdf1 In db1.TableDefs
‘ If obj.IsLoaded = True Then
‘ ‘ Print name of obj.
‘ Debug.Print obj.Name
‘ End Ifstr2 = tdf1.Name
If Not Left(str2, 4) = “MSys” Then
str1 = str1 & vbCrLf & tdf1.Name
str1 = str1 & ” — ”
For Each fld1 In tdf1.Fields
str1 = str1 & vbCrLf & ” ” & fld1.Name
str1 = str1 & ” // ” & fld1.Type
str1 = str1 & ” // ” & fld1.Size
Next fld1
End If
Next tdf1
Call ClipBoard_SetText(str1) ‘AccesssExit:
On Error Resume Next
‘ Application.ScreenUpdating = True
DoCmd.Hourglass FalseExit Sub
E_Handle:
Select Case Err.Number
Case 9999999
‘Tell XXX to ignore this error and move on to the next line
Resume Next
Case Else
‘Pop up a message box with the error and exit the Procedure
strMsg = strMsg & vbCrLf & “Error ” & Err.Number & “, ” & Err.Description & vbCrLf & “sTableAndFieldList”
‘ Call ClipBoard_SetText(strMsg) ‘Excel
‘ Call CopyToClipBoard(strMsg) ‘Word
‘ Call ClipBoardCopyTo(strMsg) ‘PowerPoint
Call ClipBoard_SetText(strMsg) ‘AccessMsgBox “Error ” & Err.Number & “, ” & Err.Description & vbCrLf & “sTableAndFieldList”
End SelectStop
Resume sExitEnd Sub
WSrory
AskWoody LoungerWSbluegoose1776
AskWoody LoungerViewing 5 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 24H2 is broadly available
by
Alex5723
10 minutes ago -
Microsoft is killing Authenticator
by
Alex5723
21 minutes ago -
Downloads folder location
by
CWBillow
6 hours, 37 minutes ago -
Remove a User from Login screen
by
CWBillow
9 hours, 9 minutes ago -
TikTok fined €530 million for sending European user data to China
by
Nibbled To Death By Ducks
10 hours, 19 minutes ago -
Microsoft Speech Recognition Service Error Code 1002
by
stanhutchings
16 hours, 23 minutes ago -
Is it a bug or is it expected?
by
Susan Bradley
2 hours, 23 minutes ago -
Image for Windows TBwinRE image not enough space on target location
by
bobolink
12 hours, 56 minutes ago -
Start menu jump lists for some apps might not work as expected on Windows 10
by
Susan Bradley
20 hours, 56 minutes ago -
Malicious Go Modules disk-wiping malware
by
Alex5723
10 hours, 32 minutes ago -
Multiple Partitions?
by
CWBillow
11 hours, 12 minutes ago -
World Passkey Day 2025
by
Alex5723
1 day, 4 hours ago -
Add serial device in Windows 11
by
Theodore Dawson
1 day, 19 hours ago -
Windows 11 users reportedly losing data due forced BitLocker encryption
by
Alex5723
13 minutes ago -
Cached credentials is not a new bug
by
Susan Bradley
2 days ago -
Win11 24H4 Slow!
by
Bob Bible
2 days ago -
Microsoft hiking XBox prices starting today due to Trump’s tariffs
by
Alex5723
1 day, 21 hours ago -
Asus adds “movement sensor” to their Graphics cards
by
n0ads
2 days, 2 hours ago -
‘Minority Report’ coming to NYC
by
Alex5723
1 day, 23 hours ago -
Apple notifies new victims of spyware attacks across the world
by
Alex5723
2 days, 11 hours ago -
Tracking content block list GONE in Firefox 138
by
Bob99
2 days, 10 hours ago -
How do I migrate Password Managers
by
Rush2112
1 day, 18 hours ago -
Orb : how fast is my Internet connection
by
Alex5723
1 day, 20 hours ago -
Solid color background slows Windows 7 login
by
Alex5723
2 days, 23 hours ago -
Windows 11, version 24H2 might not download via Windows Server Updates Services
by
Alex5723
2 days, 21 hours ago -
Security fixes for Firefox
by
Susan Bradley
37 minutes ago -
Notice on termination of services of LG Mobile Phone Software Updates
by
Alex5723
3 days, 9 hours ago -
Update your Apple Devices Wormable Zero-Click Remote Code Execution in AirPlay..
by
Alex5723
3 days, 18 hours ago -
Amazon denies it had plans to be clear about consumer tariff costs
by
Alex5723
3 days, 9 hours ago -
Return of the brain dead FF sidebar
by
EricB
2 days, 21 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.