Link to home
Start Free TrialLog in
Avatar of Elroy Taulton
Elroy TaultonFlag for United States of America

asked on

Passing <uniqueidentifier> from MS Access 2007 to SQL Database Table

I am creating a Access Form (2007) that will be utilize to update and create new records that are stored in a backend SQL Server 2008 Table.  One of my fields in this table is a UniqueID.  From SQL, I can use newid() to create this unique value.  How can do this in the actual Access Form OR what are my options for this?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

There are many ways...

One is to use a function that simply adds 1 to the highest number

Function NextNumber() as long
    NextNumber=Dmax("YourIDField","YourTable")+1
end function.

This may not be perfect for a multi-user environment...

So lets see what other experts post...

JeffCoachman
Avatar of Elroy Taulton

ASKER

Thanks Jeff, but you are correct.  This is a multi-user environment and this method may cause problems.  Are there other options for doing this?
SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes.

I have a UniqueID field in my SQL table.  It is type uniueidentifier and a primary key.
So are you saying if you add a record in Access, the SQL autonumber is not created?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for chiming in mbizup...
As you know SQL is not my strong point...

;-)

Jeff
Thanks for the help on this one.