PC Review


Reply
Thread Tools Rate Thread

Access 2007 data types supporting multiple values

 
 
Ken Warthen
Guest
Posts: n/a
 
      28th Jul 2008
In an Access 2007 table I'm using the new feature on a field (GroupMemberID)
that supports multiple values. I"ve set the Display Control property to List
Box and the Allow Multiple Values property to Yes. In Datasheet view the
field displays a drop down box with check boxes for all the GroupMemberIDs.
If you select a few they will be displayed in the field like 41, 52, 55.

In the same database I have a form that collects information and then adds a
record to the table with the GroupMemberID field. When I try to
programmatically add the record Access generates an error on the
GroupMemberID field. A sample of part of my code follows.

Has anyone worked with this new feature? If so, what's the trick to making
it work, and are there any known resources on this new feature?

Here's my code:

Private Sub cmdSave_Click()
On Error GoTo PROC_ERROR
' Add the entered data into tblEmailGroups and tblEmailGroupMembers
Dim strCompany As String
Dim strEmailGroupName As String
Dim strAffiliation As String
Dim strDSiProjectNumber As String
Dim sGroupMembers As String
Dim i As Integer
Dim strName As String
Dim rs As DAO.Recordset

Select Case Me.frameGroupAffiliation
Case 1 'Company Email Group
strAffiliation = "Company"
Case 2 'Project Email Group
strAffiliation = "Project"
For i = 0 To Me.lstNewGroupMembers.ListCount - 1
Debug.Print Me.lstNewGroupMembers.ItemData(i)
If i = 0 Then
'This is the first record
sGroupMembers = Me.lstNewGroupMembers.ItemData(i)
Else
sGroupMembers = sGroupMembers & "," &
Me.lstNewGroupMembers.ItemData(i)
End If
Next i
'Add record to tblEmailGroups
Set rs = CurrentDb.OpenRecordset("tblEmailGroups")
With rs
.AddNew
.Fields("GroupName") = Nz(Me.txtNewEmailGroupName)
.Fields("CompanyID") = Nz(Me.cboSelectCompany.Column(0))
.Fields("Affiliation") = strAffiliation
.Fields("AffiliationReferenceNumber") =
Nz(Me.cboAffiliatedProject.Column(1))
.Fields("GroupMemberID") = sGroupMembers
.Update
End With
rs.Close
Set rs = Nothing

Case Else
'Do nothing
End Select
Debug.Print sGroupMembers

PROC_EXIT:
Exit Sub
PROC_ERROR:
Call ShowError("cmdSave_Click", Err.Number, Err.Description, Err.Source)
Resume PROC_EXIT
Resume
End Sub

And the error number is 64224
The description: Method 'Value' of object 'Field2' failed

As usual, any help is greatly appreciated.

Ken





 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007 Changing My Data Types =?Utf-8?B?S2V2aW4=?= Microsoft Access Getting Started 4 28th Sep 2007 09:29 PM
Access 2007 supporting more than 2GB files? Jan Microsoft Access 7 25th Nov 2006 08:53 PM
Assigning different values to different types of data being entere =?Utf-8?B?Sm9zaA==?= Microsoft Excel New Users 1 15th Jan 2006 03:59 AM
supporting .exe file types twalters@kcmpi.net Microsoft Windows 2000 File System 0 1st Dec 2003 09:54 PM
Memory/performance efficient collection with fixed size and supporting several types? DC Microsoft C# .NET 0 11th Jul 2003 02:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.