{"id":371,"date":"2013-01-16T01:33:01","date_gmt":"2013-01-16T01:33:01","guid":{"rendered":"http:\/\/regina-whipp.com\/blog\/?p=371"},"modified":"2019-08-02T20:15:59","modified_gmt":"2019-08-03T00:15:59","slug":"upsize","status":"publish","type":"post","link":"https:\/\/regina-whipp.com\/blog\/?p=371","title":{"rendered":"So you&#8217;re ready to upsize&#8230;"},"content":{"rendered":"<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Here are\u00a0a few tips when upsizing tables to an SQL Server that I have picked up along the way&#8230;<\/span><\/span><\/p>\n<p><strong><span style=\"color: #008000;\">Make a Back-Up of your Database&#8230;<\/span> <\/strong><span style=\"color: #999999;\">(added 7.26.2013)<\/span><\/p>\n<p>Need I say more?<\/p>\n<p><span style=\"font-family: Tahoma; color: #008000;\"><b>Just say *NO* to<\/b>\u2026<\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026Special Characters or Symbols<\/span><\/span><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">These characters have meaning when used in Access and on an SQL Server. \u00a0While wrapping your table\/column names in square brackets will *allow* it, it is best to avoid these symbols when name Objects or Fields\u2026<\/span><\/span><\/p>\n<div align=\"center\">\n<table border=\"0\" width=\"132\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"bottom\" nowrap=\"nowrap\" width=\"132\"><b><span style=\"font-family: Tahoma;\">Reserved Symbols<\/span><\/b><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">.<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">\/<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">*<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">:<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">!<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">#<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">&amp;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">&#8211;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">?<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">&#8220;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">&#8216;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">$<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><span style=\"font-family: Tahoma;\">%<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><span style=\"color: #000000;\"><b><span style=\"font-family: Tahoma;\">\u2026Spaces<\/span><\/b><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Like Special Characters and Symbols you will have to bracket any table\/field name that has a space.<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><b><span style=\"font-family: Tahoma;\">\u2026Words reserved for Access of SQL Server<\/span><\/b><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">In Microsoft Access you can pretty much name your fields whatever you like.\u00a0 You can even use Reserved Words just as long as you remember to bracket them when using in VBA and, yes, the same applies to an SQL Server.\u00a0 However, you may not realize you\u2019ve used a Reserved Word and will spend hours trying to figure out why your query isn\u2019t working, for example\u2026<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">This individual could not figure out what was wrong with their statement.\u00a0 Several people chimed in to help and no one noticed the Reserved Word *<b>Group<\/b>*\u2026<\/span><\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nstrSQL = &quot;INSERT INTO Table101Contract(IDContract, Group) &quot; &amp;amp;amp; _\r\n          &quot;SELECT&quot; &amp;amp;amp; lngIDContract &amp;amp;amp; &quot;, Group &quot; &amp;amp;amp; _\r\n           &quot;FROM Table101Contract WHERE IDContract = &quot; &amp;amp;amp; varIDContract\r\n<\/pre>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Once *<b>Group<\/b>* is bracketed the statement performs as it should&#8230;<\/span><\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nstrSQL = &quot;INSERT INTO Table101Contract(IDContract, &#x5B;Group]) &quot; &amp;amp;amp; _\r\n          &quot;SELECT &quot; &amp;amp;amp; lngIDContract &amp;amp;amp; &quot;, &#x5B;Group] &quot; &amp;amp;amp; _\r\n           &quot;FROM Table101Contract WHERE IDContract = &quot; &amp;amp;amp; varIDContract\r\n<\/pre>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">&#8230;however, avoiding the use of such words will save you lots of headache in the long run.<\/span><\/span><\/p>\n<p><a href=\"http:\/\/regina-whipp.com\/blog\/?page_id=465\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">Reserved Words for Microsoft Access and SQL Server<\/span><\/a><br \/>\n<a href=\"http:\/\/allenbrowne.com\/AppIssueBadWord.html\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">Allen Browne\u2019s Complete List of Reserved Words<\/span><\/a><span style=\"font-family: Tahoma;\">\u00a0 The most complete list on the Internet!<br \/>\n<\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms189822(v=sql.110).aspx\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">SQL Server 2012 Reserved Words<\/span><\/a><br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms189822(v=sql.105).aspx\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">SQL Server 2008 R2 Reserved Words<\/span><\/a><br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms189822(v=sql.90).aspx\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">SQL Server 2005 Reserved Words<\/span><\/a><br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa238507(SQL.80).aspx\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">SQL Server 2000 Reserved Words<\/span><\/a><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026Look-Up Fields<\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Tahoma; color: #000000;\">Lookup will not be upsized to SQL Server or any other database as they are exclusive to Access.\u00a0 In theory, it was a brilliant idea but in reality it\u2019s a short cut you need to avoid.\u00a0 And, they really don\u2019t do you any favors in Access; see <\/span><a href=\"http:\/\/access.mvps.org\/access\/lookupfields.htm\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">Why you should never use Look-Up Fields<\/span><\/a><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">.<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026Multivalued fields<\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">Introduced in Access 2007 <\/span><a href=\"http:\/\/office.microsoft.com\/en-us\/access\/HA012337221033.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">complex columns that can record multiple values<\/a> my give you what you want in a regular<span style=\"color: #000000;\"> database but it is not compatible with any other database.\u00a0 Instead use what I call look up tables<\/span><\/span><\/p>\n<p><b><span style=\"font-family: Tahoma; color: #000000;\">\u2026<\/span><a href=\"http:\/\/allenbrowne.com\/casu-09.html\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">Hyperlink data type<\/span><\/a><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Introduced in Access 97, it will store paths to documents on your computer, web sites, network path but has no equivalent on SQL Server.<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026Prefixing tables with Sys, USys, MSys or a tilde *~*<\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Tahoma; color: #000000;\">This has only one real drawback&#8230;\u00a0 In Access, prefixing a table with USys* or *MSys* (Access 97 or earlier) hides it from Navigation Pane but it can be shown by checking *Show Hidden Object* in <\/span><a href=\"http:\/\/www.access-diva.com\/d9.html#CMenu\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma;\">Navigation Pane Options<\/span><\/a><span style=\"font-family: Tahoma; color: #000000;\">.\u00a0 This little tip can be used to hide table(s) from the End User.<\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">When a table is deleted, Access will often keep it around, with a tilde prefix, until you *Compact &amp; Repair* and then it is gone.<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\"><b>\u2026Prefixing Queries with a tilde *~*<\/b><\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">See above\u2026<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">.<strong>..Yes\/No Data type (also known as the BIT data type)<\/strong><\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Okay, so this one is not *that* important to not use but when upsizing\u2026<\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\">The first thing to check is any and all *YesNo* fields in all tables. \u00a0They must be unchecked to <b>not<\/b> allow NULLS and you must put in a Default Value of 0 (zero).\u00a0 AND make sure you have a Default Value in the field or it will fail when changing the Properties on the Server.\u00a0 Failing to do so will make the table un-updateable.<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-family: Tahoma;\">\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-471\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/bit.png\" alt=\"bit\" width=\"331\" height=\"211\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/bit.png 331w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/bit-300x191.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/bit-150x95.png 150w\" sizes=\"auto, (max-width: 331px) 100vw, 331px\" \/><\/span><span style=\"font-family: Tahoma; color: #000000;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">Another little tip about the BIT field\u2026\u00a0 SQL Server stores Yes as 1 and False as 0.\u00a0 While it will recognize True\/False, it will not return the correct results if you use -1\/0.\u00a0 So, when running your query against an SQL Server use\u2026<\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To find <b>TRUE<\/b><\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u2026WHERE YourField &lt;&gt; 0\u00a0\u00a0 \u2018True<br \/>\n<\/span><\/span><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u2026WHERE YourField = True\u00a0\u00a0 \u2018True<\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma; color: #000000;\">\u00a0<\/span><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To find <b>FALSE<\/b><\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u2026WHERE YourField = 0\u00a0\u00a0 \u2018False<br \/>\n<\/span><\/span><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u2026WHERE YourField = False\u00a0\u00a0 \u2018False<\/span><\/span><\/p>\n<p><b>\u2026Attachment Data Type <\/b><span style=\"color: #c0c0c0;\">(added 7.27.2013)<\/span><\/p>\n<p>There is no *Attachment* data type in SQL Server.\u00a0 The only suggestion I can offer here is <a href=\"http:\/\/msdn.microsoft.com\/library\/hh461480\" target=\"_blank\" rel=\"noopener noreferrer\">FILESTREAM\u00a0Storage<\/a>.<\/p>\n<p><span style=\"color: #008000;\"><b><span style=\"font-family: Tahoma;\">Always use\u2026<\/span><\/b><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\"><b>\u2026Primary Keys (PK)<\/b><\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma;\"><span style=\"color: #000000;\">Make sure every table has a Primary Key whether you use or not.\u00a0 I use Autonumber.\u00a0 However, remember, this key is not guaranteed to be sequential so don\u2019t count on for anything.\u00a0 This Key should <strong>only<\/strong> be used as a unique identifier for the records in the tables.<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u20264 digits for years<\/span><\/span><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">You can show 2 digit years and even have your Users enter two digit for years but store 4 digits.<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026a Naming Convention<\/span><\/span><\/b><\/p>\n<p>Decide on a Naming Convention&#8230; <a href=\"http:\/\/www.access-diva.com\/d1.html\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">My Naming Conventions<\/span><\/a>\u00a0(and make sure you data is properly normalized.\u00a0 You don&#8217;t want to upsize only to find out your table structure needs to be redone!)<\/p>\n<p><span style=\"color: #008000;\"><b><span style=\"font-family: Tahoma;\">Your VBA\u2026<\/span><\/b><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">While most of your code will work fine, there are a few traps that will result in errors.\u00a0 When running and execution query against an SQL Server you will need to use dbSeeChanges or your queries will fail.\u00a0 The exception to that rule is if you are opening the query\/table in *Read Only* mode.<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Open for Read\/Write\u2026<\/span><\/span><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Set rst = dbs.OpenRecordset(&#8220;tblImport&#8221;, dbOpenDynaset, <b>dbSeeChanges<\/b>)<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Set rst = dbs.OpenRecordset(&#8220;tblImport&#8221;, dbOpenDynaset, <b>dbSeeChanges<\/b> + dbFailOnError)<\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Open to run Action *Query*\u2026<\/span><\/span><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">strSQL = &#8220;UPDATE\u2026<br \/>\n<\/span><\/span><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CurrentDb.Execute strSQL, dbFailOnError + <b>dbSeeChanges<\/b><\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">strSQL = &#8220;INSERT INTO\u2026<br \/>\n<\/span><\/span><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CurrentDb.Execute strSQL, dbFailOnError + <b>dbSeeChanges<\/b><\/span><\/span><\/p>\n<p><b><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Open for Read Only\u2026<\/span><\/span><\/b><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Set rst = dbs.OpenRecordset(&#8220;tblImport&#8221;, dbOpenSnapshot)<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">dbFailOnError will roll back the *transaction* and give you a *useful* error message, plus, one you can trap and give your Users information they can use.\u00a0 However, I have found that if you put\u2026<\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">DoCmd.SetWarning False<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026prior to your section of code, it will *fail* silently.\u00a0 So, if you are in the habit of using the above line then add\u2026<\/span><\/span><\/p>\n<p><span style=\"font-family: Tahoma; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">DoCmd.SetWarning True<\/span><\/span><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">\u2026before your strSQL line.<\/span><\/span><\/p>\n<p><span style=\"color: #008000;\"><strong>HUH?&#8230;<\/strong><\/span><\/p>\n<p>In Access, AutoNumbered fields are visible as soon as the record is added even if it hasn\u2019t been saved yet.\u00a0 That doesn\u2019t work for SQL Server as AutoNumbered\u00a0fields are only visible after the records have been saved.\u00a0 So, you would need something like&#8230;<\/p>\n<p><span style=\"color: #808080;\"><strong>In DAO&#8230;<\/strong><\/span><\/p>\n<p style=\"padding-left: 60px;\">&#8230;<br \/>\nrs.AddNew<br \/>\n&#8230;<br \/>\nrs.Update<br \/>\nrs.Move\u00a00,\u00a0rs.LastModified<br \/>\nlngNewID\u00a0=\u00a0rs!ID<br \/>\n&#8230;<\/p>\n<p>&#8230;to retreive the Autonumber.<\/p>\n<p><span style=\"color: #008000;\"><b>text\/ntext are deprecated\u2026 <\/b><span style=\"color: #999999;\">(added 1.19.2013)<\/span><\/span><\/p>\n<p>In SQL Server 2005 I use to use *<strong>ntext<\/strong>* in place of a *<strong>MEMO<\/strong>* field data type in Access.\u00a0 Well, those are gone use varchar(MAX)\/nvarchar(MAX) instead.\u00a0 (Thanks Ben Clothier, Access MVP,\u00a0for pointing that out!)\u00a0 For a complete list of what&#8217;s gone and its replacement, if it has one, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms143729(v=sql.100).aspx\" target=\"_blank\" rel=\"noopener noreferrer\">Deprecated Database Engine Features in SQL Server 2008<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms143729.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">Deprecated Database Engine Features in SQL Server 2012<\/a><\/p>\n<p><span style=\"color: #008000;\"><b>Removing the *dbo_* prefix on linked tables\u2026 <\/b><\/span><span style=\"color: #808080;\">(added 7.23.2013)<\/span><\/p>\n<p><span style=\"color: #000000;\">After linking you&#8217;re now left with Linked Tables in Access that are prefixed with, typically, dbo_.\u00a0 (This is because SQL Server uses Schemas.)\u00a0 This is a problem for all your Queries, Forms, Reports, VBA, etc&#8230;\u00a0 Let&#8217;s not panic, no need to fix *<strong>everything<\/strong>* in your database.\u00a0 Simply, copy\/paste the below into a Module (either a new one or&#8230; I keep this code in modUtilities)&#8230;\u00a0 <\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nFunction FixTableNames(strPrefix As String)\r\n'?FixTableNames(&quot;dbo_&quot;)\r\n\r\n     Dim db As Database\r\n     Dim tdf As TableDef\r\n\r\n     Set db = CurrentDb\r\n     For Each tdf In db.TableDefs\r\n        If Left(tdf.Name, Len(strPrefix)) = strPrefix Then\r\n          DoCmd.Rename Mid(tdf.Name, Len(strPrefix) + 1), acTable, tdf.Name\r\n        End If\r\n     Next\r\n\r\n     Set tdf = Nothing\r\n     Set db = Nothing\r\n\r\nEnd Function\r\n<\/pre>\n<p>Press Ctrl+G on your keyboard to bring up the Immediate window and type&#8230;<\/p>\n<p><strong>?FixTableNames(&#8220;dbo_&#8221;)<\/strong><\/p>\n<p>&#8230;click Yes (or OK) while the vcode loops thru your Table Objects removing<span style=\"color: #000000;\"> the *<strong>dbo_<\/strong>* prefix.<\/span><\/p>\n<p><span style=\"color: #008000;\"><strong>Validation Rules (Table Level)&#8230;<\/strong><\/span> <span style=\"color: #808080;\">(added 7.23.2013)<\/span><\/p>\n<p>&#8230;are converted to Table Constraints.\u00a0 This may cause a problem when trying to add new records and\/or may not Upsize correctly or properly.\u00a0 (I do my Feild Validation at the Form level.)\u00a0 For more information see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh313060.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">Incompatible Access Features (Access to SQL)<\/a>.<\/p>\n<p><span style=\"color: #008000;\"><b>Made changes?\u00a0 Refresh your\u00a0links\u2026 <\/b><\/span><span style=\"color: #808080;\">(added 9.17.2013)<\/span><\/p>\n<p>You&#8217;ve made some changes to your Tables and now you can&#8217;t enter anything, what gives?\u00a0 You need to Refresh you links, while the links are permenant they are more like *snapshots* that will stay the same until you make a change then you need a new snapshot.<\/p>\n<p>Access 2010 (and Access 2007 and Access 2013) go to the <strong>External Data<\/strong> tab&#8230;<\/p>\n<div id=\"attachment_829\" style=\"width: 1037px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-829\" class=\"wp-image-829 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab.png\" alt=\"External Data Tab\" width=\"1027\" height=\"115\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab.png 1027w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab-300x33.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab-1024x114.png 1024w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab-150x16.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/ExternalDataTab-400x44.png 400w\" sizes=\"auto, (max-width: 1027px) 100vw, 1027px\" \/><p id=\"caption-attachment-829\" class=\"wp-caption-text\">External Data Tab<\/p><\/div>\n<p>Select <strong>Linked Table Manager<\/strong>&#8230;<\/p>\n<div id=\"attachment_830\" style=\"width: 639px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-830\" class=\"wp-image-830 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/LinkedTableManager.png\" alt=\"Linked Table Manager\" width=\"629\" height=\"292\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/LinkedTableManager.png 629w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/LinkedTableManager-300x139.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/LinkedTableManager-150x69.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2013\/01\/LinkedTableManager-400x185.png 400w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><p id=\"caption-attachment-830\" class=\"wp-caption-text\">Linked Table Manager<\/p><\/div>\n<p>Then select <strong>Select All<\/strong> then <strong>OK<\/strong>.\u00a0 You can also do this from code&#8230;<\/p>\n<p><a href=\"http:\/\/allenbrowne.com\/ser-13.html\" target=\"_blank\" rel=\"noopener noreferrer\">Reconnect Attached tables on Start-up<\/a> from <a href=\"http:\/\/allenbrowne.com\/tips.html\" target=\"_blank\" rel=\"noopener noreferrer\">Allen Browne&#8217;s Tips<\/a><br \/>\n<a href=\"http:\/\/www.mvps.org\/access\/tables\/tbl0009.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Refresh Links<\/a> from <a href=\"http:\/\/access.mvps.org\/access\/\" target=\"_blank\" rel=\"noopener noreferrer\">The Access Web<\/a><\/p>\n<p><span style=\"color: #008000;\"><b>Date\/Time surprises\u2026 <\/b><\/span><span style=\"color: #808080;\">(added 11.7.2015)<\/span><\/p>\n<p>There are four types of Date fields in an SQL Server (all not available on earlier versions of SQL Server)\u2026<\/p>\n<ul>\n<li>DATE<\/li>\n<li>DATETIME2<\/li>\n<li>DATETIME<\/li>\n<li>DATETIMEOFFSET<\/li>\n<li>SMALLDATETIME<\/li>\n<li>TIME<\/li>\n<\/ul>\n<p>When upsizing your Tables to SQL Server they may convert as <strong>TEXT<\/strong> fields, this will depend how you upsize. Sure way to know whether this happened, short of going to look, is the Date Picker will not work. Should this happen you will have to go to your SQL Server tables and change the data type to <strong>DATETIME<\/strong> or <strong>DATETIME2<\/strong> and then relink\/refresh your Tables and the Date Picker will then work.<\/p>\n<p>Some will say having a Time Stamp, aka Row Version Data Type on every Table with more than a few fields is a performance boost I have yet to see any performance boost or lack thereof if I do\/don\u2019t add one.<\/p>\n<p><strong>For more information<\/strong>\u2026<\/p>\n<blockquote><p>The Access <strong>Date\/Time<\/strong> data type supports a range of values from 1\/1\/100 through 12\/31\/9999 whereas the SQL Server <strong>DATETIME<\/strong> data type is limited in range to values from 1\/1\/1753 through 12\/31\/9999. SSMA will flag values that fall outside of the SQL Server <strong>DATETIME<\/strong> range in an assessment report. Note that SSMA can convert Access <strong>DATETIME<\/strong> to SQL Server <strong>DATETIME2<\/strong>, which was introduced in SQL Server 2008. However, the new date and time data types are not supported in Access if you use Access as a Frontend after converting your data. For more information, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms180878(v=SQL.105).aspx\" target=\"_blank\" rel=\"noopener noreferrer\">Using Date and Time Data<\/a> in SQL Server Books Online.<\/p><\/blockquote>\n<p>From <a href=\"http:\/\/blogs.msdn.com\/b\/ssma\/archive\/2011\/03\/06\/access-to-sql-server-migration-understanding-data-type-conversions.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Server Migration Assistant (SSMA) Team\u2019s Blog (<strong>Working with SQL Server datetime data ranges<\/strong>)<\/a><\/p>\n<p><strong>and<\/strong>&#8230;<\/p>\n<p><a href=\"http:\/\/sqlmag.com\/sql-server\/solving-datetime-mystery\" target=\"_blank\" rel=\"noopener noreferrer\">Solving the Datetime Mystery<\/a><\/p>\n<p><strong>and posted in the <a href=\"https:\/\/answers.microsoft.com\/en-us\/msoffice\/forum\/msoffice_access-mso_win10-mso_365hp\/access-environment-after-post-migration-by-ssma\/d8c8fc36-7bd2-4a53-9af2-1586d7ed7bf4?messageId=a37822b3-f589-4d84-abc2-47623a4fe2a1\">Microsoft Answers Forum<\/a><\/strong>\u00a0by Albert Kallal (Access MVP, 2003-2017)\u00a0<span style=\"color: #999999;\">(added 7.22.2018)<\/span><strong>&#8230;<\/strong><\/p>\n<blockquote>\n<p class=\"\">Datetime2 columns work without issue with Access.<\/p>\n<p>However, you WILL have to link your tables using the SQL Native 11 (or later drivers). And you thus will have to install these drivers on each workstation.<\/p>\n<p>If you link your tables using the SQL Driver (this is a older driver installed on all versions of windows by default). If you use the older ODBC driver, then datetime2 columns will be seen by Access as text columns.<\/p>\n<p>So your choice is:<\/p>\n<p>Always migrate using the older datetime format. You can change this setting in SSMA.<\/p>\n<p>After you migrate simply use sql design tools (SSMS) and change the column type to datetime. If\u00a0 you just have say a few tables, then this is not much work.<\/p>\n<p>If you have a lot of tables, then I would consider adopting the native 11 (or later) drivers &#8211; that way you don&#8217;t have to change anything server side, and access will see + work with those types of columns correctly.<\/p>\n<p>The newer drivers are better, and supposedly faster &#8211; but I not experienced performance increases.<\/p>\n<p>So Access has no problem with datetime2, but you have to re-link your tables using a Native 11 or later driver for Access to see these columns correctly. About the only downside of this option is the noted require to ensure that these drivers are installed on any workstation you plan to run your application on .<\/p>\n<p>Regards,<br \/>\nAlbert D. Kallal (Access MVP, 2003-2017)<br \/>\nEdmonton, Alberta Canada<\/p><\/blockquote>\n<p>Tip!\u00a0 If you need to store Time ONLY then be sure to select TIMEVALUE when setting up your tables in the SQL Server.<\/p>\n<p><span style=\"color: #000000;\"><b><span style=\"color: #008000;\">And finally\u2026<\/span><\/b><\/span><span style=\"color: #000000;\"><b>\u00a0<\/b><\/span><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">Hopefully, something in this article made your job easier.\u00a0 Ready to try it for yourself?<\/span><\/span><\/p>\n<p><a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=29062\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">SQL Server 2012 Express<\/span><\/a><br \/>\n<a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/sql-server-editions-express\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">SQL Server 2017 Express<\/span><\/a><br \/>\n<a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=54255\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-family: Tahoma; color: #800080;\">Microsoft SQL Server Migration Assistant for Access v7.8 for Access<\/span><\/a><br \/>\n<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssma\/access\/creating-and-managing-projects-accesstosql?view=sql-server-2017\">Creating and Managing Projects (AccessToSQL) (for SQL Server 2017)<\/a>\u00a0 <span style=\"color: #999999;\">(added 7.24.2018)<\/span><\/p>\n<p><a href=\"http:\/\/www.accessmvp.com\/DJSteele\/DSNLessLinks.html\" target=\"_blank\" rel=\"noopener noreferrer\">Using DSN-Less Connections<\/a> by Doug Steele (Access MVP)\u00a0<span style=\"color: #999999;\"> (added 12.5.2015)<\/span><\/p>\n<p><a href=\"http:\/\/www.fmsinc.com\/MicrosoftAccess\/SQLServerUpsizing\/express\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft SQL Server Express: Version Comparison Matrix and Free Downloads<\/a>\u00a0<span style=\"color: #999999;\">(added 11.8.2015)<strong><br \/>\n<\/strong><\/span>For the first time, all the different versions of SQL Server Express from 2005 to 2014 are shown, compared, and referenced with download links.<\/p>\n<p><a href=\"http:\/\/www.fmsinc.com\/free\/NewTips\/SQL\/SQLServerExpressDatabase\/Automated_Backup.asp\" target=\"_blank\" rel=\"noopener noreferrer\">Automating the Backup of Your Microsoft SQL Server Express Databases<\/a>\u00a0<span style=\"color: #999999;\">(added 11.8.2015)<\/span><strong><br \/>\n<\/strong>If you\u2019re using SQL Server Express, you still need to create backups of the database. Here\u2019s how to automate it which wasn\u2019t easy to discover.<\/p>\n<p><a href=\"http:\/\/www.fmsinc.com\/MicrosoftAccess\/SQLServerUpsizing\/how\/index.htm\" target=\"_blank\" rel=\"noopener noreferrer\">When and How to Upsize Microsoft Access Databases to SQL Server<\/a> <span style=\"color: #999999;\">(added 11.8.2015)<\/span><\/p>\n<p><a href=\"http:\/\/thomaslarock.com\/2011\/12\/7-mistakes-you-cant-afford-to-make-when-upgrading-to-sql-2012\/\" target=\"_blank\" rel=\"noopener noreferrer\">7 Mistakes You Can&#8217;t Afford to Make When Upgrading to SQL 2012<\/a><\/p>\n<p><span style=\"color: #000000;\"><span style=\"font-family: Tahoma;\">This article is a *work in progress*,\u00a0as I come across more tips and tricks for upsizing I will post them.\u00a0 If you find a tip or trick you want me to add&#8230; <a href=\"https:\/\/www.access-diva.com\/submitatip.php\" target=\"_blank\" rel=\"noopener noreferrer\">Submit a Tip<\/a>!<\/span><\/span><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_371\" class=\"pvc_stats all  \" data-element-id=\"371\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/regina-whipp.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here are a few tips when upsizing tables to an SQL Server that I have picked up along the way&#8230;<\/p>\n<p>Make a Back-Up of your Database&#8230; (added 7.26.2013)<\/p>\n<p>Need I say more?<\/p>\n<p>Just say *NO* to\u2026<\/p>\n<p>\u2026Special Characters or Symbols<\/p>\n<p>These characters have meaning when used in Access and on an SQL Server. While wrapping [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_371\" class=\"pvc_stats all  \" data-element-id=\"371\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/regina-whipp.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,63],"tags":[64,18,28,27],"class_list":["post-371","post","type-post","status-publish","format-standard","hentry","category-access-tips","category-database-design","tag-access-tips","tag-database-design","tag-sql-server","tag-upsize","odd"],"_links":{"self":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=371"}],"version-history":[{"count":53,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/371\/revisions"}],"predecessor-version":[{"id":1384,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/371\/revisions\/1384"}],"wp:attachment":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}