JustJerry
01-05-2006, 03:16 PM
Hello and Happy New Year.
From my Start Form, I want to open up my Main Form based on three choices selected in the Start Form and display the results for the choices selected. This is the code I am attempting to use:
Private Sub OpenMainForm_Click()
On Error GoTo Err_OpenMainForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMainMile"
stLinkCriteria = "[TruckID]=" & Me![cboTruckID] And "[Month]=" & Me![cboMonth] And "[Year]=" & Me![Year]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenMainForm_Click:
Exit Sub
Err_OpenMainForm_Click:
MsgBox Err.Description
Resume Exit_OpenMainForm_Click
End Sub
When I attempt to click on the command button which runs this code, I get an error that says:
Type Mismatch
[Truck ID], [cboTruckID], and both [Year]'s, are Fixed numeric fields, and [cboMonth] and [Month] are text fields.
Can someone please send me in the right direction
From my Start Form, I want to open up my Main Form based on three choices selected in the Start Form and display the results for the choices selected. This is the code I am attempting to use:
Private Sub OpenMainForm_Click()
On Error GoTo Err_OpenMainForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMainMile"
stLinkCriteria = "[TruckID]=" & Me![cboTruckID] And "[Month]=" & Me![cboMonth] And "[Year]=" & Me![Year]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenMainForm_Click:
Exit Sub
Err_OpenMainForm_Click:
MsgBox Err.Description
Resume Exit_OpenMainForm_Click
End Sub
When I attempt to click on the command button which runs this code, I get an error that says:
Type Mismatch
[Truck ID], [cboTruckID], and both [Year]'s, are Fixed numeric fields, and [cboMonth] and [Month] are text fields.
Can someone please send me in the right direction