M
MaryF
Hello,
I am having problems with trying to filter a filtered pop-up form.
I have a command button cmdNetReq on a main form frm_System that opens a
related record in frm_NetRequirements. On the pop-up frm_NetRequirements, I
have 4 NetType check boxes/yes-no fields: NetReq_Operator,
NetReq_Maintainer, NetReq_Trainer, NetReq_NoTraining. Next to three of those
check boxes I have command buttons where the user can click to view details
for that specific training type for the system.
These are 2K one-to-many relationships:
tbl_System (SysID) PK and tbl_NetRequirements (NetReq_SystemID) FK
tbl_NetType (NetTypeID) PK and tbl_NetRequirements (NetReq_NetTypeID) FK
The code below ends up giving me all of the records in the database that are
for Train the Trainer class, instead of only the one record for that filtered
system. And I am getting a “Type mismatch†error when there is no related
Train the Trainer record. Can anyone please help me with this code? I hope I
have given you enough information.
Private Sub cmdTrainer_Click() ‘ this command button is on
frm_NetRequirements
' Shows the filtered data for the Train the Trainer Training
On Error GoTo Err_cmdTrainer_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim NewData As String
Dim strMsg As String
Dim mbrResponse As String
stDocName = "frm_NetRequirements"
stLinkCriteria = "Forms![frm_System].Form![SysID] =" &
Me![NetReq_SystemID]
If (NetReq_NetTypeID) = Null Then
strMsg = NewData & "There is no training information for this system,
would you like to add this information?"
mbrResponse = MsgBox(strMsg, vbYesNo + vbQuestion, "New Data")
Select Case mbrResponse
Case vbYes
'Add new data"
DoCmd.OpenForm stDocName, , , , acFormAdd, ,
Me!NetReq_SystemID
Case vbNo
Exit Sub
End Select
Else
Me.Form.Filter = "[NetReq_NetTypeID]=" & 3 And stLinkCriteria
Me.FilterOn = True
DoCmd.OpenForm stDocName, , , , acFormAdd, , stLinkCriteria
End If
Exit_cmdTrainer_Click:
Exit Sub
Err_cmdTrainer_Click:
MsgBox Err.Description
Resume Exit_cmdTrainer_Click
End Sub
Thank you very much,
Mary
I am having problems with trying to filter a filtered pop-up form.
I have a command button cmdNetReq on a main form frm_System that opens a
related record in frm_NetRequirements. On the pop-up frm_NetRequirements, I
have 4 NetType check boxes/yes-no fields: NetReq_Operator,
NetReq_Maintainer, NetReq_Trainer, NetReq_NoTraining. Next to three of those
check boxes I have command buttons where the user can click to view details
for that specific training type for the system.
These are 2K one-to-many relationships:
tbl_System (SysID) PK and tbl_NetRequirements (NetReq_SystemID) FK
tbl_NetType (NetTypeID) PK and tbl_NetRequirements (NetReq_NetTypeID) FK
The code below ends up giving me all of the records in the database that are
for Train the Trainer class, instead of only the one record for that filtered
system. And I am getting a “Type mismatch†error when there is no related
Train the Trainer record. Can anyone please help me with this code? I hope I
have given you enough information.
Private Sub cmdTrainer_Click() ‘ this command button is on
frm_NetRequirements
' Shows the filtered data for the Train the Trainer Training
On Error GoTo Err_cmdTrainer_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim NewData As String
Dim strMsg As String
Dim mbrResponse As String
stDocName = "frm_NetRequirements"
stLinkCriteria = "Forms![frm_System].Form![SysID] =" &
Me![NetReq_SystemID]
If (NetReq_NetTypeID) = Null Then
strMsg = NewData & "There is no training information for this system,
would you like to add this information?"
mbrResponse = MsgBox(strMsg, vbYesNo + vbQuestion, "New Data")
Select Case mbrResponse
Case vbYes
'Add new data"
DoCmd.OpenForm stDocName, , , , acFormAdd, ,
Me!NetReq_SystemID
Case vbNo
Exit Sub
End Select
Else
Me.Form.Filter = "[NetReq_NetTypeID]=" & 3 And stLinkCriteria
Me.FilterOn = True
DoCmd.OpenForm stDocName, , , , acFormAdd, , stLinkCriteria
End If
Exit_cmdTrainer_Click:
Exit Sub
Err_cmdTrainer_Click:
MsgBox Err.Description
Resume Exit_cmdTrainer_Click
End Sub
Thank you very much,
Mary