|
-
Jul 26th, 2012, 09:32 AM
#1
[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
......
-
Jul 26th, 2012, 09:45 AM
#2
Fanatic Member
Re: MS Access - GUID in recordset - data type conversion error
Just a guess, maybe try Me.FormID.Text?
-
Jul 26th, 2012, 10:08 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|