Access_guy49
Registered User.
- Local time
- Today, 17:40
- Joined
- Sep 7, 2007
- Messages
- 462
Ok, in a nutshell, i'm working with a form where i have a listbox. and based on a button the user selects, i want the listbox to populate with something. So I'm setting the rowsource to be an SQL statement, and then from there doing a requery.
My SQL statement that works in a query is:
My VBA is:
MyYear is a string variable which is set with an inputbox.
When i set the rowsource and then requery, Nothing is displayed... any ideas would be appreciated
My SQL statement that works in a query is:
Code:
SELECT Schools.NAME, tbl_SchlPrgms.Date, tbl_SchlPrgms.Loc, tbl_SchlPrgms.StdntNm, tbl_SchlPrgms.Rev, tbl_Link_schoolPrograms.Grades, tbl_Program.Name
FROM (Schools INNER JOIN tbl_SchlPrgms ON Schools.SchlID = tbl_SchlPrgms.Schl_ID) INNER JOIN (tbl_Program INNER JOIN tbl_Link_schoolPrograms ON tbl_Program.ProgID = tbl_Link_schoolPrograms.ProgramID) ON tbl_SchlPrgms.ID = tbl_Link_schoolPrograms.SchlPrgID
WHERE (((Format([Date],"yyyy"))=[Enter Year]));
My VBA is:
Code:
MySQL = "SELECT Schools.NAME, tbl_SchlPrgms.Date, tbl_SchlPrgms.Loc, tbl_SchlPrgms.StdntNm, tbl_SchlPrgms.Rev, tbl_Link_schoolPrograms.Grades, tbl_Program.Name FROM (Schools INNER JOIN tbl_SchlPrgms ON Schools.SchlID = tbl_SchlPrgms.Schl_ID) INNER JOIN (tbl_Program INNER JOIN tbl_Link_schoolPrograms ON tbl_Program.ProgID = tbl_Link_schoolPrograms.ProgramID) ON tbl_SchlPrgms.ID = tbl_Link_schoolPrograms.SchlPrgID WHERE (((Format([Date]," & "''" & "yyyy" & "''" & "))=[" & MyYear & "]));"
MyYear is a string variable which is set with an inputbox.
When i set the rowsource and then requery, Nothing is displayed... any ideas would be appreciated