Laocon
09-04-2001, 01:25 AM
Hi all,
I have two combo boxes - one which filters the record source for the second - and a button on a form.
I'm using this code on the OnClick of the button, but it doesn't work - I get a 'Type mismatch' error:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "DEF_Forecast MF"
DoCmd.OpenForm stDocName, , , ("[CompanyID]=" & Me![CompanyID] And "[PeriodID]=" & Me![PeriodID])
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
Anyway, assuming I can get over this hurdle, I want to move onto the second hurdle...
I actually want to open 3 copies of DEF_Forecast MF. One for [PeriodID], One for [PeriodID]+1 and one for [PeriodID]+2.
I want these to be opened at the same time, after pressing the button, so that the user must fill out the subform of [PeriodID], then after closing this form, the user must fill out the subform of [PeriodID]+1, after closing and then [PeriodID]+2 ... I realise therefore that you actually need to open them in reverse order so that [PeriodID] is opened last and filled in first...
Sounds simple - but I just can't do it! BTW I am not good with code...
I have two combo boxes - one which filters the record source for the second - and a button on a form.
I'm using this code on the OnClick of the button, but it doesn't work - I get a 'Type mismatch' error:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "DEF_Forecast MF"
DoCmd.OpenForm stDocName, , , ("[CompanyID]=" & Me![CompanyID] And "[PeriodID]=" & Me![PeriodID])
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
Anyway, assuming I can get over this hurdle, I want to move onto the second hurdle...
I actually want to open 3 copies of DEF_Forecast MF. One for [PeriodID], One for [PeriodID]+1 and one for [PeriodID]+2.
I want these to be opened at the same time, after pressing the button, so that the user must fill out the subform of [PeriodID], then after closing this form, the user must fill out the subform of [PeriodID]+1, after closing and then [PeriodID]+2 ... I realise therefore that you actually need to open them in reverse order so that [PeriodID] is opened last and filled in first...
Sounds simple - but I just can't do it! BTW I am not good with code...