I am attempting to use a "Select Case" statement that references a combo box on a form (not linked to a table) to open up the appropriate form for the database user. When I execute the code, I get an error: "Object required." I've seen this problem appear elsewhere in the messageboards, but was unable to determine what I am doing wrong based on other member's postings. Since I am new to coding figuring this out has been difficult. I am unsure as to whether the order of my coding is correct, if I need other dim and set statements after the Select Case coding, and if the combo box is being referenced correctly. Below is my code. Any guidance would be greatly appreciated, thanks!
-Steve
Code
Private Sub cboSelectTransferType_AfterUpdate()
On Error GoTo Err_cboSelectTransferType_AfterUpdate
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
'Trying to reference form "frmTransferSelect" and the combo box "cboSelectTransferType"
Select Case (frmTransferSelect.cboSelectTransferType)
Case "Live Auction"
stDocName = "frmLiveAuction"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "Local Bid"
stDocName = "frmLocalBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "MiBid"
stDocName = "frmMiBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "Sealed Bid"
stDocName = "frmSealedBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "State Agency"
stDocName = "frmToStateAgency"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case Else
stDocName = "frmTransfers"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
End Select
Exit_cboSelectTransferType_AfterUpdate:
Exit Sub
Err_cboSelectTransferType_AfterUpdate:
MsgBox Err.Description
Resume Exit_cboSelectTransferType_AfterUpdate
End Sub
-Steve
Code
Private Sub cboSelectTransferType_AfterUpdate()
On Error GoTo Err_cboSelectTransferType_AfterUpdate
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
'Trying to reference form "frmTransferSelect" and the combo box "cboSelectTransferType"
Select Case (frmTransferSelect.cboSelectTransferType)
Case "Live Auction"
stDocName = "frmLiveAuction"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "Local Bid"
stDocName = "frmLocalBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "MiBid"
stDocName = "frmMiBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "Sealed Bid"
stDocName = "frmSealedBid"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case "State Agency"
stDocName = "frmToStateAgency"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case Else
stDocName = "frmTransfers"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
End Select
Exit_cboSelectTransferType_AfterUpdate:
Exit Sub
Err_cboSelectTransferType_AfterUpdate:
MsgBox Err.Description
Resume Exit_cboSelectTransferType_AfterUpdate
End Sub