I have the following code behind a command button of an option group that has 2 radio buttons. Case 1 or case 2 will work by themselves but as soon as both are in the code clicking the command button does nothing not even an error code..
Private Sub cmdAddTo_Click()
Dim RS As DAO.Recordset
Dim strSQL As String
Select Case Me![frameSelect]
Case 1
Dim ContractID As Long
ContractID = InputBox("Enter the Contract ID of the record you want to add to.")
strSQL = "Select ContractID From tblMaintContract Where ContractID = " & ContractID
Set RS = CurrentDb.OpenRecordset(strSQL)
If RS.EOF Then
'What to do when not found
MsgBox "Record not found. Please enter another number."
Else
'What to do when found
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddToMaintContract"
stLinkCriteria = "[ContractID]=" & [ContractID]
DoCmd.Close acForm, "frmMain"
DoCmd.OpenForm "frmBack"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
RS.Close
Set RS = Nothing
Case 2
Dim WebDesignID As Long
WebDesignID = InputBox("Enter the WebDesign ID of the record you want to add to.")
strSQL = "Select WebDesignID From tblWebDesign Where WebDesignID = " & WebDesignID
Set RS = CurrentDb.OpenRecordset(strSQL)
If RS.EOF Then
'What to do when not found
MsgBox "Record not found. Please enter another number."
Else
'What to do when found
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddToWebDesign"
stLinkCriteria = "[WebDesignID]=" & [WebDesignID]
DoCmd.Close acForm, "frmMain"
DoCmd.OpenForm "frmBack"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
RS.Close
Set RS = Nothing
End Select
End Sub
Thanks for any help..
ignacious
Private Sub cmdAddTo_Click()
Dim RS As DAO.Recordset
Dim strSQL As String
Select Case Me![frameSelect]
Case 1
Dim ContractID As Long
ContractID = InputBox("Enter the Contract ID of the record you want to add to.")
strSQL = "Select ContractID From tblMaintContract Where ContractID = " & ContractID
Set RS = CurrentDb.OpenRecordset(strSQL)
If RS.EOF Then
'What to do when not found
MsgBox "Record not found. Please enter another number."
Else
'What to do when found
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddToMaintContract"
stLinkCriteria = "[ContractID]=" & [ContractID]
DoCmd.Close acForm, "frmMain"
DoCmd.OpenForm "frmBack"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
RS.Close
Set RS = Nothing
Case 2
Dim WebDesignID As Long
WebDesignID = InputBox("Enter the WebDesign ID of the record you want to add to.")
strSQL = "Select WebDesignID From tblWebDesign Where WebDesignID = " & WebDesignID
Set RS = CurrentDb.OpenRecordset(strSQL)
If RS.EOF Then
'What to do when not found
MsgBox "Record not found. Please enter another number."
Else
'What to do when found
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddToWebDesign"
stLinkCriteria = "[WebDesignID]=" & [WebDesignID]
DoCmd.Close acForm, "frmMain"
DoCmd.OpenForm "frmBack"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
RS.Close
Set RS = Nothing
End Select
End Sub
Thanks for any help..
ignacious