HELP!!! - Replication IDs from CODE!! 
Author Message
 HELP!!! - Replication IDs from CODE!!

How in the world does one work with replication ID's in code????(Access
95!!)
Like for example,,, I have a main table and a related table ( a one-to-one
relationship but that is extraneous to the problem). When a record gets
added to the first table i want a record inserted with the same ID in the
realted table. I know,,, make it all one table right,,, sorry not an option.
So i try to write a SQL statement in code to append to the related table...
OOps,, it won't let me reference the value of the RepID.( it debug prints as
?????? now thats mighty helpful,,,)
I try same thing with rs.addnew and still can't get the value of the repID
from the field on the form I using. If you can't use RepID's in code doesn't
that severly limit their usefullness. What was MS thinking??? They added a
new data type to their database but didn't add a datatype to the language
used to manuplate the database. Not very smart I say..... HELP!!!! PLEASE!!

Vince Mounts

http://www.*-*-*.com/



Sat, 22 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

You can treat a Replication ID as a variant array (not an array of variants)
with 16 elements.  I would have thought that you could directly assign one
Replication ID to another, but I haven't tried it myself.  If you do need to
store the value of a Replication ID use a variant datatype.

The following two functions might be of use.

'**************  Code Start  *********************
Function StringFromGuid(varGuid As Variant) As String
  Dim intX As Integer
  Dim strret As String
  For intX = 0 To UBound(varGuid)
    strret = strret & Chr$(varGuid(intX))
  Next
  StringFromGuid = strret
End Function

Function GuidFromString(strIn As String) As Variant
  Dim varRet As Variant

  Dim intTemp(15) As Integer
  Dim intX As Integer
  For intX = 0 To 15
    intTemp(intX) = Asc(Mid(strIn, intX + 1, 1))
  Next
  varRet = Array(intTemp(0), intTemp(1), intTemp(2), intTemp(3), intTemp(4),
intTemp(5), intTemp(6), intTemp(7), intTemp(8), intTemp(9), intTemp(10),
intTemp(11), intTemp(12), intTemp(13), intTemp(14), intTemp(15))
  Debug.Print StringFromGuid(varRet)
  GuidFromString = varRet
End Function
'**************  Code End  ***********************

They are not tested, but appear to me to be the sort of functions that would
be required.

Quote:

>How in the world does one work with replication ID's in code????(Access
>95!!)
>Like for example,,, I have a main table and a related table ( a one-to-one
>relationship but that is extraneous to the problem). When a record gets
>added to the first table i want a record inserted with the same ID in the
>realted table. I know,,, make it all one table right,,, sorry not an
option.
>So i try to write a SQL statement in code to append to the related table...
>OOps,, it won't let me reference the value of the RepID.( it debug prints
as
>?????? now thats mighty helpful,,,)
>I try same thing with rs.addnew and still can't get the value of the repID
>from the field on the form I using. If you can't use RepID's in code
doesn't
>that severly limit their usefullness. What was MS thinking??? They added a
>new data type to their database but didn't add a datatype to the language
>used to manuplate the database. Not very smart I say..... HELP!!!! PLEASE!!

>Vince Mounts

>http://vmounts.home.mindspring.com



Sun, 23 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

What you are going to have to do is to write a little piece of VBA, which
will copy the record, which was entered into the first table via the form,
into the second table.  Try puting this into the After Update event on the
form.  

Also, you might try looking at a book called "Access95 Developer's
Handbook", by Litwin, Getz, and Gilbert.  It is a really good resource and
covers a wide range of topics in great detail.  Good Luck!
--
Marion Wicks
Programmer - GE Financial Assurance, Seattle



Quote:
> How in the world does one work with replication ID's in code????(Access
> 95!!)
> Like for example,,, I have a main table and a related table ( a
one-to-one
> relationship but that is extraneous to the problem). When a record gets
> added to the first table i want a record inserted with the same ID in the
> realted table. I know,,, make it all one table right,,, sorry not an
option.
> So i try to write a SQL statement in code to append to the related
table...
> OOps,, it won't let me reference the value of the RepID.( it debug prints
as
> ?????? now thats mighty helpful,,,)
> I try same thing with rs.addnew and still can't get the value of the
repID
> from the field on the form I using. If you can't use RepID's in code
doesn't
> that severly limit their usefullness. What was MS thinking??? They added
a
> new data type to their database but didn't add a datatype to the language
> used to manuplate the database. Not very smart I say..... HELP!!!!
PLEASE!!

> Vince Mounts

> http://vmounts.home.mindspring.com



Sun, 23 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

Look for StringFromGUID() and GUIDFromString() in Help.  Usually you
need to get the GUID into a string using StringFromGUID() so that you
can manipulate it.

Be aware that it's sometimes difficult to guess whether a replication ID
(GUID) is going to appear as a 16 byte binary number or in its string
representation, especially when you're dealing with form controls.  As
far as I remember, form controls can sometimes give you a string GUID
that looks like {12345678-...} rather than {GUID {12345678-...}}.

If you're using GUIDs to join tables, you may want to be aware that
we've found some bugs in this area in Access 97.  Most queries work
successfully (surprisingly, you can even join Access GUIDs to a 16 byte
binary data type in SQL server reliably), but we had problems with two
reports containing subreports.  In these cases we couldn't get the
child/master fields in the subreport object to join at all, so the
subreport came out blank.  Other reports based on less complex queries
worked without problems.  We never solved these problems, and abandoned
trying to use GUIDs for the primary and foreign keys in our tables.  We
continue to use them for replication and database synchronisation.  As
you've already found, long integers are much easier to manipulate than
GUIDs!



Quote:
>How in the world does one work with replication ID's in code????(Access
>95!!)
>Like for example,,, I have a main table and a related table ( a one-to-one
>relationship but that is extraneous to the problem). When a record gets
>added to the first table i want a record inserted with the same ID in the
>realted table. I know,,, make it all one table right,,, sorry not an option.
>So i try to write a SQL statement in code to append to the related table...
>OOps,, it won't let me reference the value of the RepID.( it debug prints as
>?????? now thats mighty helpful,,,)
>I try same thing with rs.addnew and still can't get the value of the repID
>from the field on the form I using. If you can't use RepID's in code doesn't
>that severly limit their usefullness. What was MS thinking??? They added a
>new data type to their database but didn't add a datatype to the language
>used to manuplate the database. Not very smart I say..... HELP!!!! PLEASE!!

>Vince Mounts

>http://vmounts.home.mindspring.com

------
Mark Horton
ISC Ltd
------
Humans should reply to nreader at domain insci.demon
followed by .co.uk


Sun, 23 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

That's alright but Vince is using Access95 not Access97, so StringFromGUID
and GUIDFromString are not available.

Quote:

>Look for StringFromGUID() and GUIDFromString() in Help.  Usually you
>need to get the GUID into a string using StringFromGUID() so that you
>can manipulate it.

>Be aware that it's sometimes difficult to guess whether a replication ID
>(GUID) is going to appear as a 16 byte binary number or in its string
>representation, especially when you're dealing with form controls.  As
>far as I remember, form controls can sometimes give you a string GUID
>that looks like {12345678-...} rather than {GUID {12345678-...}}.

>If you're using GUIDs to join tables, you may want to be aware that
>we've found some bugs in this area in Access 97.  Most queries work
>successfully (surprisingly, you can even join Access GUIDs to a 16 byte
>binary data type in SQL server reliably), but we had problems with two
>reports containing subreports.  In these cases we couldn't get the
>child/master fields in the subreport object to join at all, so the
>subreport came out blank.  Other reports based on less complex queries
>worked without problems.  We never solved these problems, and abandoned
>trying to use GUIDs for the primary and foreign keys in our tables.  We
>continue to use them for replication and database synchronisation.  As
>you've already found, long integers are much easier to manipulate than
>GUIDs!



>>How in the world does one work with replication ID's in code????(Access
>>95!!)
>>Like for example,,, I have a main table and a related table ( a one-to-one
>>relationship but that is extraneous to the problem). When a record gets
>>added to the first table i want a record inserted with the same ID in the
>>realted table. I know,,, make it all one table right,,, sorry not an
option.
>>So i try to write a SQL statement in code to append to the related
table...
>>OOps,, it won't let me reference the value of the RepID.( it debug prints
as
>>?????? now thats mighty helpful,,,)
>>I try same thing with rs.addnew and still can't get the value of the repID
>>from the field on the form I using. If you can't use RepID's in code
doesn't
>>that severly limit their usefullness. What was MS thinking??? They added a
>>new data type to their database but didn't add a datatype to the language
>>used to manuplate the database. Not very smart I say..... HELP!!!!
PLEASE!!

>>Vince Mounts

>>http://vmounts.home.mindspring.com

>------
>Mark Horton
>ISC Ltd
>------
>Humans should reply to nreader at domain insci.demon
>followed by .co.uk



Mon, 24 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

Good point, Terry!  Fortunately StringFromGUID and GUIDFromString _are_
in Access 95 VBA; they're just not documented in the Access 95 help
file.

StringFromGUID takes a byte array and returns a string representation of
the GUID; GUIDFromString goes the other way and returns a byte array.

It can be difficult to guess what format Access will use when it hands
you a GUID.  For example, if you use DLookup on a GUID field...

strGUID = DLookup("s_GUID", "Mytable")
debug.print strGUID

gives " ; _1J? ?  `T Z"  (or something similar)

you can capture the return value in a string, and you get a 16 byte
string.  If you want to convert it to its printable representation, you
first have to convert it to a byte array...

dim b as byte(15)
dim i as integer

for i = 0 to 15
        b(i) = asc(mid(strGUID, i+1,1))
next i

debug.print StringFromGUID(b)

gives "{guid {5F9D3B1E-4AB9-11D1-B890-00609754195A}}" (or similar)



Quote:
>That's alright but Vince is using Access95 not Access97, so StringFromGUID
>and GUIDFromString are not available.

------
Mark Horton
ISC Ltd
------
Humans should reply to nreader at domain insci.demon
followed by .co.uk


Mon, 24 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

Um, those functions exist in Access 95.

Michael

Quote:

>That's alright but Vince is using Access95 not Access97, so StringFromGUID
>and GUIDFromString are not available.


>>Look for StringFromGUID() and GUIDFromString() in Help.  Usually you
>>need to get the GUID into a string using StringFromGUID() so that you
>>can manipulate it.

>>Be aware that it's sometimes difficult to guess whether a replication ID
>>(GUID) is going to appear as a 16 byte binary number or in its string
>>representation, especially when you're dealing with form controls.  As
>>far as I remember, form controls can sometimes give you a string GUID
>>that looks like {12345678-...} rather than {GUID {12345678-...}}.

>>If you're using GUIDs to join tables, you may want to be aware that
>>we've found some bugs in this area in Access 97.  Most queries work
>>successfully (surprisingly, you can even join Access GUIDs to a 16 byte
>>binary data type in SQL server reliably), but we had problems with two
>>reports containing subreports.  In these cases we couldn't get the
>>child/master fields in the subreport object to join at all, so the
>>subreport came out blank.  Other reports based on less complex queries
>>worked without problems.  We never solved these problems, and abandoned
>>trying to use GUIDs for the primary and foreign keys in our tables.  We
>>continue to use them for replication and database synchronisation.  As
>>you've already found, long integers are much easier to manipulate than
>>GUIDs!



>>>How in the world does one work with replication ID's in code????(Access
>>>95!!)
>>>Like for example,,, I have a main table and a related table ( a
one-to-one
>>>relationship but that is extraneous to the problem). When a record gets
>>>added to the first table i want a record inserted with the same ID in the
>>>realted table. I know,,, make it all one table right,,, sorry not an
>option.
>>>So i try to write a SQL statement in code to append to the related
>table...
>>>OOps,, it won't let me reference the value of the RepID.( it debug prints
>as
>>>?????? now thats mighty helpful,,,)
>>>I try same thing with rs.addnew and still can't get the value of the
repID
>>>from the field on the form I using. If you can't use RepID's in code
>doesn't
>>>that severly limit their usefullness. What was MS thinking??? They added
a
>>>new data type to their database but didn't add a datatype to the language
>>>used to manuplate the database. Not very smart I say..... HELP!!!!
>PLEASE!!

>>>Vince Mounts

>>>http://vmounts.home.mindspring.com

>>------
>>Mark Horton
>>ISC Ltd
>>------
>>Humans should reply to nreader at domain insci.demon
>>followed by .co.uk



Mon, 24 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

So I've now found, they are completely missing from the help file though,
which is where I was trying to find them.

Quote:

>Um, those functions exist in Access 95.

>Michael


>>That's alright but Vince is using Access95 not Access97, so StringFromGUID
>>and GUIDFromString are not available.


>>>Look for StringFromGUID() and GUIDFromString() in Help.  Usually you
>>>need to get the GUID into a string using StringFromGUID() so that you
>>>can manipulate it.

>>>Be aware that it's sometimes difficult to guess whether a replication ID
>>>(GUID) is going to appear as a 16 byte binary number or in its string
>>>representation, especially when you're dealing with form controls.  As
>>>far as I remember, form controls can sometimes give you a string GUID
>>>that looks like {12345678-...} rather than {GUID {12345678-...}}.

>>>If you're using GUIDs to join tables, you may want to be aware that
>>>we've found some bugs in this area in Access 97.  Most queries work
>>>successfully (surprisingly, you can even join Access GUIDs to a 16 byte
>>>binary data type in SQL server reliably), but we had problems with two
>>>reports containing subreports.  In these cases we couldn't get the
>>>child/master fields in the subreport object to join at all, so the
>>>subreport came out blank.  Other reports based on less complex queries
>>>worked without problems.  We never solved these problems, and abandoned
>>>trying to use GUIDs for the primary and foreign keys in our tables.  We
>>>continue to use them for replication and database synchronisation.  As
>>>you've already found, long integers are much easier to manipulate than
>>>GUIDs!



>>>>How in the world does one work with replication ID's in code????(Access
>>>>95!!)
>>>>Like for example,,, I have a main table and a related table ( a
>one-to-one
>>>>relationship but that is extraneous to the problem). When a record gets
>>>>added to the first table i want a record inserted with the same ID in
the
>>>>realted table. I know,,, make it all one table right,,, sorry not an
>>option.
>>>>So i try to write a SQL statement in code to append to the related
>>table...
>>>>OOps,, it won't let me reference the value of the RepID.( it debug
prints
>>as
>>>>?????? now thats mighty helpful,,,)
>>>>I try same thing with rs.addnew and still can't get the value of the
>repID
>>>>from the field on the form I using. If you can't use RepID's in code
>>doesn't
>>>>that severly limit their usefullness. What was MS thinking??? They added
>a
>>>>new data type to their database but didn't add a datatype to the
language
>>>>used to manuplate the database. Not very smart I say..... HELP!!!!
>>PLEASE!!

>>>>Vince Mounts

>>>>http://vmounts.home.mindspring.com

>>>------
>>>Mark Horton
>>>ISC Ltd
>>>------
>>>Humans should reply to nreader at domain insci.demon
>>>followed by .co.uk



Mon, 24 Jul 2000 03:00:00 GMT  
 HELP!!! - Replication IDs from CODE!!

Ah, that was because the problem was found at the last minute of Access 95,
the issues between when one expected the canonical format for a GUID and
when one expected the binary format.

Of course the built-in Access functions don't help much for VB, so I had to
write 'em all over again anyway, although I used the ole32 routines rather
than the ones posted here, because they are more robust.

Michael

Quote:

>So I've now found, they are completely missing from the help file though,
>which is where I was trying to find them.


>>Um, those functions exist in Access 95.

>>Michael


>>>That's alright but Vince is using Access95 not Access97, so
StringFromGUID
>>>and GUIDFromString are not available.


>>>>Look for StringFromGUID() and GUIDFromString() in Help.  Usually you
>>>>need to get the GUID into a string using StringFromGUID() so that you
>>>>can manipulate it.

>>>>Be aware that it's sometimes difficult to guess whether a replication ID
>>>>(GUID) is going to appear as a 16 byte binary number or in its string
>>>>representation, especially when you're dealing with form controls.  As
>>>>far as I remember, form controls can sometimes give you a string GUID
>>>>that looks like {12345678-...} rather than {GUID {12345678-...}}.

>>>>If you're using GUIDs to join tables, you may want to be aware that
>>>>we've found some bugs in this area in Access 97.  Most queries work
>>>>successfully (surprisingly, you can even join Access GUIDs to a 16 byte
>>>>binary data type in SQL server reliably), but we had problems with two
>>>>reports containing subreports.  In these cases we couldn't get the
>>>>child/master fields in the subreport object to join at all, so the
>>>>subreport came out blank.  Other reports based on less complex queries
>>>>worked without problems.  We never solved these problems, and abandoned
>>>>trying to use GUIDs for the primary and foreign keys in our tables.  We
>>>>continue to use them for replication and database synchronisation.  As
>>>>you've already found, long integers are much easier to manipulate than
>>>>GUIDs!



>>>>>How in the world does one work with replication ID's in code????(Access
>>>>>95!!)
>>>>>Like for example,,, I have a main table and a related table ( a
>>one-to-one
>>>>>relationship but that is extraneous to the problem). When a record gets
>>>>>added to the first table i want a record inserted with the same ID in
>the
>>>>>realted table. I know,,, make it all one table right,,, sorry not an
>>>option.
>>>>>So i try to write a SQL statement in code to append to the related
>>>table...
>>>>>OOps,, it won't let me reference the value of the RepID.( it debug
>prints
>>>as
>>>>>?????? now thats mighty helpful,,,)
>>>>>I try same thing with rs.addnew and still can't get the value of the
>>repID
>>>>>from the field on the form I using. If you can't use RepID's in code
>>>doesn't
>>>>>that severly limit their usefullness. What was MS thinking??? They
added
>>a
>>>>>new data type to their database but didn't add a datatype to the
>language
>>>>>used to manuplate the database. Not very smart I say..... HELP!!!!
>>>PLEASE!!

>>>>>Vince Mounts

>>>>>http://vmounts.home.mindspring.com

>>>>------
>>>>Mark Horton
>>>>ISC Ltd
>>>>------
>>>>Humans should reply to nreader at domain insci.demon
>>>>followed by .co.uk



Mon, 24 Jul 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Need aid using Replication IDs in code

2. Replication Id in ASP - desperately need help

3. Openform with replication ID

4. Need an AutoNumber Replication ID

5. Referring to a Replication ID's

6. Crystal and Access 97 with replication id's

7. Using Access 97 replication ID's with VB5 data control and other bound controls

8. Using an Access database with replication ID's as primary keys in VB

9. RDO + Replication ID Issue

10. NEED HELP - WIN ID CODES

11. HELP: Machine-ID or/and HDD-ID

12. Disabling Outlook 2000 Menu Items - Finding Control ID, IDs, ID's

 

 
Powered by phpBB® Forum Software