Sub Create_Group2()
Dim cat As ADOX.Catalog
On Error GoTo ErrorHandle
Set cat = New ADOX.Catalog
With cat
.ActiveConnection = CurrentProject.Connection
.Groups.Append "Masters"
End With
ExitHere:
Set cat = Nothing
Exit Sub
ErrorHandle:
If Err.Number = -2147467259 Then
MsgBox "This group already exists."
Else
MsgBox Err.Description
End If
Resume ExitHere
End Sub
|