NauticalGent
Ignore List Poster Boy
- Local time
- Today, 00:39
- Joined
- Apr 27, 2015
- Messages
- 6,321
Greetings AWF,
I cant believe I cant figure this out, yet here I am. I am trying to do something cute that involves Creating a table with default values. One of those values contains a comma and it has got me stumped...
When I run it, I get the following error:
I have tried:
And with the exception of the first example, they all throw the same error...
I KNOW it has to be something easy, but I cannot figure it out, someone throw me a bone...
I cant believe I cant figure this out, yet here I am. I am trying to do something cute that involves Creating a table with default values. One of those values contains a comma and it has got me stumped...
Code:
Public Sub CreateNewTable()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim Fld01 As DAO.Field
Dim Fld02 As DAO.Field
Dim Fld03 As DAO.Field
Set db = CurrentDb
Set tdf = db.CreateTableDef("tblSQLTables")
Set Fld01 = tdf.CreateField()
Set Fld02 = tdf.CreateField()
Set Fld03 = tdf.CreateField()
With Fld01
.Name = "SQLTableName"
.Type = dbText
.Size = 50
.Required = True
End With
With Fld02
.Name = "SQLServer"
.Type = dbText
.Size = 50
.DefaultValue = "[COLOR="Red"]SEUSQL50\INST01,1437[/COLOR]"
End With
With Fld03
.Name = "SQLdb"
.Type = dbText
.Size = 50
.DefaultValue = "RMC_Tracker"
End With
tdf.Fields.Append Fld01
tdf.Fields.Append Fld02
tdf.Fields.Append Fld03
db.TableDefs.Append tdf
db.TableDefs.Refresh
Application.RefreshDatabaseWindow
End Sub
When I run it, I get the following error:
3320 - Syntax error (comma) in table-level validation expression.
I have tried:
Code:
= "'SEUSQL50\INST01,1437'" ' This throws no error, but includes the single quotes
= "SEUSQL50\INST01" & "," & "1437"
= "SEUSQL50\INST01," & "1437"
= "SEUSQL50\INST01" & ",1437"
= "SEUSQL50\INST01" & Chr(44) & "1437"
And with the exception of the first example, they all throw the same error...
I KNOW it has to be something easy, but I cannot figure it out, someone throw me a bone...
Last edited: