M
Mark H.
Hello:
I am able to add 2 boolean columns to an existing Access
2000 table but how do I set the format of the boolean
type to Yes/No? When I do it progrmatically the columns
get added but the format in the tab on the bottom is
blank whereas when I enter via Access directly it's set
to Yes/No. How do I set this programatically? Here is
the code I am using now. Thank you in advance for your
response!
Private Sub UpdateSecurityTblViewEditSharedFileErrors
(ByRef objConn As ADODB.Connection)
On Error GoTo DbError
Dim strDB As String
Dim catCurr As ADOX.Catalog
Dim objRs As ADODB.Recordset
Set catCurr = New ADOX.Catalog
'catCurr.ActiveConnection = objConn
strDB = "Data Source=" & App.Path
& "\RxScriptTracker.mdb;"
catCurr.ActiveConnection
= "Provider=Microsoft.Jet.OLEDB.4.0;" & strDB
With catCurr.Tables("Security")
' Add the new fields for viewing and editing Shared
File errors
.Columns.Append "ViewSharedFileErrors", adBoolean, 1
.Columns.Append "EditSharedFileErrors", adBoolean, 1
End With
Set catCurr = Nothing
' Now update the Administrator Security class so that
these new options are enabled by default
Set objRs = New ADODB.Recordset
objRs.Open "Security", objConn, adOpenForwardOnly,
adLockOptimistic
If objRs.EOF = False Then
With objRs
Do Until .EOF = True
If !ClassName = "Administrator" Then
!ViewSharedFileErrors.Value = True
!EditSharedFileErrors.Value = True
End If
.MoveNext
Loop
End With
End If
objRs.Close
Exit Sub
DbError:
Dim strErrMsg As String
strErrMsg = "Error creating Shared File Errors Table" &
vbCrLf & vbCrLf & Err.Description
MsgBox strErrMsg, vbOKOnly, "Shared File Error Table"
End Sub
I am able to add 2 boolean columns to an existing Access
2000 table but how do I set the format of the boolean
type to Yes/No? When I do it progrmatically the columns
get added but the format in the tab on the bottom is
blank whereas when I enter via Access directly it's set
to Yes/No. How do I set this programatically? Here is
the code I am using now. Thank you in advance for your
response!
Private Sub UpdateSecurityTblViewEditSharedFileErrors
(ByRef objConn As ADODB.Connection)
On Error GoTo DbError
Dim strDB As String
Dim catCurr As ADOX.Catalog
Dim objRs As ADODB.Recordset
Set catCurr = New ADOX.Catalog
'catCurr.ActiveConnection = objConn
strDB = "Data Source=" & App.Path
& "\RxScriptTracker.mdb;"
catCurr.ActiveConnection
= "Provider=Microsoft.Jet.OLEDB.4.0;" & strDB
With catCurr.Tables("Security")
' Add the new fields for viewing and editing Shared
File errors
.Columns.Append "ViewSharedFileErrors", adBoolean, 1
.Columns.Append "EditSharedFileErrors", adBoolean, 1
End With
Set catCurr = Nothing
' Now update the Administrator Security class so that
these new options are enabled by default
Set objRs = New ADODB.Recordset
objRs.Open "Security", objConn, adOpenForwardOnly,
adLockOptimistic
If objRs.EOF = False Then
With objRs
Do Until .EOF = True
If !ClassName = "Administrator" Then
!ViewSharedFileErrors.Value = True
!EditSharedFileErrors.Value = True
End If
.MoveNext
Loop
End With
End If
objRs.Close
Exit Sub
DbError:
Dim strErrMsg As String
strErrMsg = "Error creating Shared File Errors Table" &
vbCrLf & vbCrLf & Err.Description
MsgBox strErrMsg, vbOKOnly, "Shared File Error Table"
End Sub