Create group out of vba code

  • Thread starter Thread starter Ralf
  • Start date Start date
R

Ralf

Hi,

When a new database is created a group 'Favorites' exists already. I would
like to create additional ones, but with vba code. Furthermore it would be
great to assign tables and queries to the groups which have been created.

Is that possible?
Thanks,
Ralf
 
The code below should get you going and the original source is listed if you
wish to looked it up further.

Public Sub CreateUserGroup(strGroupName As String, _
strPID As String)
' Create a group
' Source: Graham R Seach - MS Access MVP
'
http://groups.google.ca/group/micro...read/thread/3527785593af7279/b0d043a4d1dd6886
Dim wrk As DAO.Workspace
Dim grp As DAO.Group

Set wrk = DBEngine(0)
On Error GoTo CreateUserGroupErr

'Create the new group
Set grp = wrk.CreateGroup(strGroupName, strPID)
ws.Groups.Append grp

CreateUserGroupErr:
Set grp = Nothing
Set wrk = Nothing
End Sub
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Back
Top