B
Bryan Hughes
Hello,
I have problem that I cannot figure out. I have a main form that case
managers use a cbo to select open cases. Once the Case is selected from the
cbo a subform shows the clients of that case file in a subform. If case
manager wants to change information for a particular client, the user clicks
a cmdbtn and it opens another form called frmClient_Details, using Client_ID
as the stLinkCriteria.
On load event the frmClient_Details runs two Class Modules,
CFStatusTestClass1(Case File Status) and CFSTStatusTestClass1(Client Status)
to check for conditions in the file and client status in several tables.
This works fine except for a couple of instances. On a couple of Client_ID
records the form On Load event gives
Error 94 - Invalid Use Of Null.
I cannot determine why. The Client_ID field for this record has data in it
the same format as the others. The class module CFSTStatusTestClass1,
Defines CID As String. If I load a client from the same case file it loads
just fine and class module works perfectly.
Why is it doing this and how can I fix this.
.............................................................
CmdBtn Event:
Private Sub cmdOpenClient_Click()
Dim stDocName As String
Dim stLinkCriteria As String
On Error GoTo Err_cmdOpenClient_Click
stDocName = "frmClient_Details_RO"
stLinkCriteria = "[CID]='" & Me![frmFST_Case_File_Clients].Form![ClientID] &
"'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
Forms("frmClient_Details_RO").txtEMPID = Me.cbxCM.Column(2)
Forms("frmClient_Details_RO").txtACM = Me.cbxCM.Column(1)
Exit_cmdOpenClient_Click:
Exit Sub
Err_cmdOpenClient_Click:
MsgBox Err.Description
Resume Exit_cmdOpenClient_Click
End Sub
.............................................................................
Begining part Of On Load Event
Private Sub Form_Load()
Dim CFS As New CFStatusTestClass1
Dim CS As New CFSTStatusTestClass1
Dim strCID As String
Dim vDOB As Date
Dim vDate As Date
Dim vAge As Integer
Dim vAG As String
Dim booCFStatus As Boolean
Dim booCStatus As Boolean
Dim strACM As String
booCFStatus = False
booCStatus = False
'Case File Status Class Module
CFS.ccfs Me.CFID
'Client Status Class Module
CS.csfst Me.CID
............................................................
Class Module:
Option Compare Database
'Check Clients FST Status
Public Sub csfst(CID As String)
Dim rstCID As ADODB.Recordset
Dim cmd1 As Command
Dim strSQL As String
Dim booFileStatus As Boolean
Dim intCStatus As Integer
Dim strACM As String, strEMPID As String
booFileStatus = False
Set cmd1 = New ADODB.Command
cmd1.ActiveConnection = CurrentProject.Connection
'SQL statement and assign to cmd1
strSQL = "SELECT CID, FS, CM, EMPID FROM tblFST WHERE CID='" & CID & "'" &
";"
cmd1.CommandText = strSQL
cmd1.CommandType = adCmdText
Set rstCID = New ADODB.Recordset
rstCID.Open cmd1
With rstCID
If .EOF And .BOF Then
intCStatus = 0
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Exit Sub
ElseIf .Fields("FS") = "OPEN" Then
booFileStatus = True
ElseIf .Fields("FS") = "CLOSED" Then
booFileStatus = False
End If
If booFileStatus = True Then
strACM = .Fields("CM")
strEMPID = .Fields("EMPID")
intCStatus = 1
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Forms("frmClient_Details_RO").txtACM = strACM
Forms("frmClient_Details_RO").txtEMPID = strEMPID
Exit Sub
End If
End With
If booFileStatus = False Then
intCStatus = 2
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Exit Sub
End If
End Sub
........................................................
Please Help
-Bryan
I have problem that I cannot figure out. I have a main form that case
managers use a cbo to select open cases. Once the Case is selected from the
cbo a subform shows the clients of that case file in a subform. If case
manager wants to change information for a particular client, the user clicks
a cmdbtn and it opens another form called frmClient_Details, using Client_ID
as the stLinkCriteria.
On load event the frmClient_Details runs two Class Modules,
CFStatusTestClass1(Case File Status) and CFSTStatusTestClass1(Client Status)
to check for conditions in the file and client status in several tables.
This works fine except for a couple of instances. On a couple of Client_ID
records the form On Load event gives
Error 94 - Invalid Use Of Null.
I cannot determine why. The Client_ID field for this record has data in it
the same format as the others. The class module CFSTStatusTestClass1,
Defines CID As String. If I load a client from the same case file it loads
just fine and class module works perfectly.
Why is it doing this and how can I fix this.
.............................................................
CmdBtn Event:
Private Sub cmdOpenClient_Click()
Dim stDocName As String
Dim stLinkCriteria As String
On Error GoTo Err_cmdOpenClient_Click
stDocName = "frmClient_Details_RO"
stLinkCriteria = "[CID]='" & Me![frmFST_Case_File_Clients].Form![ClientID] &
"'"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria
Forms("frmClient_Details_RO").txtEMPID = Me.cbxCM.Column(2)
Forms("frmClient_Details_RO").txtACM = Me.cbxCM.Column(1)
Exit_cmdOpenClient_Click:
Exit Sub
Err_cmdOpenClient_Click:
MsgBox Err.Description
Resume Exit_cmdOpenClient_Click
End Sub
.............................................................................
Begining part Of On Load Event
Private Sub Form_Load()
Dim CFS As New CFStatusTestClass1
Dim CS As New CFSTStatusTestClass1
Dim strCID As String
Dim vDOB As Date
Dim vDate As Date
Dim vAge As Integer
Dim vAG As String
Dim booCFStatus As Boolean
Dim booCStatus As Boolean
Dim strACM As String
booCFStatus = False
booCStatus = False
'Case File Status Class Module
CFS.ccfs Me.CFID
'Client Status Class Module
CS.csfst Me.CID
............................................................
Class Module:
Option Compare Database
'Check Clients FST Status
Public Sub csfst(CID As String)
Dim rstCID As ADODB.Recordset
Dim cmd1 As Command
Dim strSQL As String
Dim booFileStatus As Boolean
Dim intCStatus As Integer
Dim strACM As String, strEMPID As String
booFileStatus = False
Set cmd1 = New ADODB.Command
cmd1.ActiveConnection = CurrentProject.Connection
'SQL statement and assign to cmd1
strSQL = "SELECT CID, FS, CM, EMPID FROM tblFST WHERE CID='" & CID & "'" &
";"
cmd1.CommandText = strSQL
cmd1.CommandType = adCmdText
Set rstCID = New ADODB.Recordset
rstCID.Open cmd1
With rstCID
If .EOF And .BOF Then
intCStatus = 0
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Exit Sub
ElseIf .Fields("FS") = "OPEN" Then
booFileStatus = True
ElseIf .Fields("FS") = "CLOSED" Then
booFileStatus = False
End If
If booFileStatus = True Then
strACM = .Fields("CM")
strEMPID = .Fields("EMPID")
intCStatus = 1
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Forms("frmClient_Details_RO").txtACM = strACM
Forms("frmClient_Details_RO").txtEMPID = strEMPID
Exit Sub
End If
End With
If booFileStatus = False Then
intCStatus = 2
Forms("frmClient_Details_RO").txtFSTClientStatus = intCStatus
Exit Sub
End If
End Sub
........................................................
Please Help
-Bryan