Newid()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to insert a row into a table, one of the columns is a
uniqueidentifier (primary key) for my insert I have the following code.

dim varExhID as variant

varExhID = newid()

strSQL = "Insert into ExhibitorsTest (ExhibitorID, ExhibitorShortName,
ExhibitorName, ProductDescription, DivisionID, ShowCategories) " & _
"VALUES ('" & varExhID & "'," & _
"'" & strExhibitorShortName & "', " & _
"'" & strExhibitorName & "', " & _
"'" & strProductDescription & "', " & _
varDivID & _
"'" & bytShowCategories & "')"

The error I get is Compile error, Sub or Function not defined and it does
Does not like the newID() What function is used to create a unique GUID so I
can insert a row into the table?

Thanks
ToniS
 
There is a newid() function available with T-SQL on SQL-Server, however,
it's far from clear if your code is running inside a stored procedure on
SQL-Server or in VBA code somewhere else; like inside one of your ADP
projects.

Any function available on SQL-Server will not be accessible in VBA code.
 
Thanks for the information, I currently have this w/i the VBA Code, I will
attempt to write a Stored Procedure so I can use the newid() function

Thanks
 
Back
Top