G
Guest
How do I get a command button to open a particular form chosen according to a
control value?
For example, let's say I have a form frmOrders on which there is a control
cboCurrency.
I want a button cmbReceipts on frmOrders to open one of three possible forms
- frmReceiptsEUR, frmReceiptsGBP, or frmReceiptsUSD - according to whether
the value selected in cboLanguage is "EUR" or "GBP" or "USD". How do I code
the On Click event of cmbOpenDetails to do that?
The code generated by the wizard simply to open a single form frmReceipts is
as follows, and I can't figure out how to modify it:
Private Sub cmbReceipts_Click()
On Error GoTo Err_cmbReceipts_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmReceipts"
stLinkCriteria = "[tblReceipts.OrderID]=" & Me![txtOrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmbReceipts_Click:
Exit Sub
Err_cmbReceipts_Click:
MsgBox Err.Description
Resume Exit_cmbReceipts_Click
End Sub
control value?
For example, let's say I have a form frmOrders on which there is a control
cboCurrency.
I want a button cmbReceipts on frmOrders to open one of three possible forms
- frmReceiptsEUR, frmReceiptsGBP, or frmReceiptsUSD - according to whether
the value selected in cboLanguage is "EUR" or "GBP" or "USD". How do I code
the On Click event of cmbOpenDetails to do that?
The code generated by the wizard simply to open a single form frmReceipts is
as follows, and I can't figure out how to modify it:
Private Sub cmbReceipts_Click()
On Error GoTo Err_cmbReceipts_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmReceipts"
stLinkCriteria = "[tblReceipts.OrderID]=" & Me![txtOrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmbReceipts_Click:
Exit Sub
Err_cmbReceipts_Click:
MsgBox Err.Description
Resume Exit_cmbReceipts_Click
End Sub