T
trekgoes2malaysia
When opeing a form, I want the control_click routine to filter records
by year. Problem is 'Year' is not a field in the table from which the
form gets its data. I have a dateid in the table instead that links
to another "dates" table where 'Year' can be obtained. Question is how
do I filter records by 'Year' then on a form that links to a table
without the field 'Year'? Below is my code where I tried using a
query to achieve this but because the field year is not part of the
table, i keep getting a parameter prompt for 'Year' when I click on
the control.
Any help is appreciated,
Patrick
******************************************************************
Public Sub WelcomeNext2_Click()
On Error GoTo Err_WelcomeNext2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Datelog"
stLinkCriteria = "[athleteid]=" & Me![AthleteCombo1] & " and " &
"[Year] = " & Me!{Yearpicked]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acLast
Exit_WelcomeNext2_Click:
Exit Sub
Err_WelcomeNext2_Click:
MsgBox Err.Description
Resume Exit_WelcomeNext2_Click
End Sub
by year. Problem is 'Year' is not a field in the table from which the
form gets its data. I have a dateid in the table instead that links
to another "dates" table where 'Year' can be obtained. Question is how
do I filter records by 'Year' then on a form that links to a table
without the field 'Year'? Below is my code where I tried using a
query to achieve this but because the field year is not part of the
table, i keep getting a parameter prompt for 'Year' when I click on
the control.
Any help is appreciated,
Patrick
******************************************************************
Public Sub WelcomeNext2_Click()
On Error GoTo Err_WelcomeNext2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Datelog"
stLinkCriteria = "[athleteid]=" & Me![AthleteCombo1] & " and " &
"[Year] = " & Me!{Yearpicked]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acLast
Exit_WelcomeNext2_Click:
Exit Sub
Err_WelcomeNext2_Click:
MsgBox Err.Description
Resume Exit_WelcomeNext2_Click
End Sub