Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter for Access Function

Status
Not open for further replies.

brownmary

Technical User
Mar 12, 2003
14
US
I have an In-Line Function in an Access 2003 database attached to a SQL Server. I am trying to set up a Form to enter a parameter for the function. Everything works fine mechanically with the form (it opens the function) but it does not retrieve any records.

I believe the problem might be related to the Criteria field in the function. According to non-SQL directions for creating a parameter in a form, I enter [Forms]![Name of Form]![Field] in the Criteria. However, Access adds an = sign and ' ' marks. My SQL for the criteria looks like:

ALTER FUNCTION DeansOffice.[Check PT]
()
RETURNS TABLE
AS
RETURN ( SELECT TOP 100 PERCENT Term, PTLastName, PTFirstName, ACC, CourseNum, Section, Salary
FROM dbo.PTFaculty
WHERE (Term = '[Forms]![PT Faculty by Dept and Term]![Term]') )

What am I doing wrong?

Thks.

Mary
 
What does the code look like from your form. Are you just using the field? I would create code behind the form and have it execute the stored procedure from SQL and pass the perameter at that time.

Others may do it differently.
 
The Event Procedure when a user clicks the OK button is:

Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenFunction "Check PT", View:=acViewNormal, DataMode:=acReadOnly
DoCmd.Close acForm, "PT Faculty by Dept and Term"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top