Results 1 to 3 of 3

Thread: [RESOLVED] MS Access - GUID in recordset - data type conversion error

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Resolved [RESOLVED] MS Access - GUID in recordset - data type conversion error

    I'm having trouble assigning a GUID value using a RecordSet, using MS Access. I get a data type conversion error when trying the below code. What is the correct way to assign a GUID value to a GUID field in a recordset?

    Code:
    Dim rst As Recordset
    Set rst = Me.BehaviorDetail_subform.Form.RecordsetClone
    MsgBox StringFromGUID(Me.FormID.Value) 'shows the correct guid string, so the value is there
    If rst.RecordCount = 0 Then
            'add new time records for row
            rst.AddNew
            rst!FormID = Me.FormID '<-- problem is here. FormID is GUID type in recordset, Me.FormID is a bound textbox that has a valid GUID object
            rst!TimeID = 1
            rst.Update
            ......

  2. #2
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Re: MS Access - GUID in recordset - data type conversion error

    Just a guess, maybe try Me.FormID.Text?

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: MS Access - GUID in recordset - data type conversion error

    I figured it out. The Guid String returned was in the format of "{guid {...}}", and the recordset just needs the Guid string value enclosed with "{...}" only, so if you just remove the "{guid ... }" part in the string, it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width