Create group out of vba code

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
 
D

Daniel Pineault

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top