Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Generating a SQL UniqueIdentifier

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DevalilaJohn - 30 Jan 2006 21:00 GMT
I have an Access 2003 front end to a MS SQL 2000 database.  One form uses
data from a view.  I have no trouble updating the table underlieing the view,
but in order to add data, I need to pass a value back in a field of data type
(SQL) uniqueidentifier.  The field is the key on the underlieing table and
set to Not Null, so it fails before my INSTEAD trigger can take over.

Can anyone tell me if there is an Access equivalant to the SQL newid()
function, or if not, how to generate the uniqueidentifier?

Thanks for your assistance,

John
Alex Dybenko - 31 Jan 2006 06:44 GMT
Hi,
you can use this code as startup:
http://support.microsoft.com/kb/176790/en-us

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

>I have an Access 2003 front end to a MS SQL 2000 database.  One form uses
> data from a view.  I have no trouble updating the table underlieing the
[quoted text clipped - 10 lines]
>
> John
DevalilaJohn - 31 Jan 2006 13:57 GMT
That should work very nicely, Thank you.

> Hi,
> you can use this code as startup:
[quoted text clipped - 14 lines]
> >
> > John
DevalilaJohn - 31 Jan 2006 20:21 GMT
The solution provided a way to generate a GUID.  Unfortunately, I can't get
the GUID into my rows when a new one is being created.  The View that I am
working with is linked as a table via ODBC.  I have a Before Insert trigger
(ASccess) on the maintenance form and have tried a myriad of approaches to
putting a GUID into the relevant row in that procedure, getting a variety of
error messages.  

This leads me to question if Access actually understands what a GUID is?  
The row in question was defined as a Number of type Replication ID when I
linked the table.  I can't find any documentation references to a Replication
ID.  

The value that gets passed to the SQL database is irrelevant as a legitimate
GUID is applied by the INSTEAD OF trigger on the server.  As a test I tride
to assign a value of 10 to the GUID column and got an error message that the
value is too large.  I have tried the GUIDFromString function which gives me
a 16 byte GUID, but then how do I get it into the cell?

So now I'm down to wondering what am I missing? Do I need to detach the form
from any table(s) and just fetch and update data when the user identifies and
changes existing data and apply a similar methodology to inserts and deletes?

Any insights would be appreciated.

Thanks again,

John

> I have an Access 2003 front end to a MS SQL 2000 database.  One form uses
> data from a view.  I have no trouble updating the table underlieing the view,
[quoted text clipped - 8 lines]
>
> John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.