BJackson,
I believe I followed your instructions, but likely I coded something wrong, so I've included my button's code for your review.
My Select routine is only returning the error message:
Microsoft Access Can't find the object 'ChargeEstimate'.
I think I understand that "ChargeEstimate" is a variable and does not actually exist as a query name.
Following is the exact code in my program:
Private Sub cmdEstimatedCustomerCost_Click()
On Error GoTo Err_cmdEstimatedCustomerCost_Click
Dim stDocName As String
stDocName = "Estimated Costs For Repair Work"
Select Case Me![Frame105].Value
Case 1
ChargeEstimate = "qryEstimatedCharge"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 2
ChargeEstimate = "qryEstimatedCharge625"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 3
ChargeEstimate = "qryEstimatedCharge6p5"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 4
ChargeEstimate = "qryEstimatedCharge675"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 5
ChargeEstimate = "qryEstimatedCharge7p"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 6
ChargeEstimate = "qryEstimatedCharge725"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 7
ChargeEstimate = "qryEstimatedCharge7p5"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 8
ChargeEstimate = "qryEstimatedCharge775"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case 9
ChargeEstimate = "qryEstimatedCharge8p"
DoCmd.OpenQuery "ChargeEstimate", , acViewNormal
Case Else
End Select
DoCmd.OpenReport stDocName, acPreview
Exit_cmdEstimatedCustomerCost_Click:
Exit Sub
Err_cmdEstimatedCustomerCost_Click:
MsgBox Err.Description
Resume Exit_cmdEstimatedCustomerCost_Click
End Sub
I have cut and past the entire code above to rule out
errors while making this reply.
I also declared a Global variable for ChargeEstimate and didn't know where to put it, so I put it in declarations, along with the Option Explicit and Option Compare Database statements. Was that correct to do ?
Please help,
Thanks,
Jim