syntax to reference a combo box on an open form in a query

WinDancer

Registered User.
Local time
Yesterday, 17:51
Joined
Oct 29, 2004
Messages
290
I am writing a query using a combo box on an open form as a parameter.

the combo box is three fields, name, address, and phone.

I am trying to use forms!ParticipantPicker!combo58.col(0)
to select the name to use in the query

and am getting a syntax error.

This reference works to write a record from a form... so it certainly won't work in a query :)

Can someone post the correct way to reference a combo box column on a form in a query?

Thanks,
Dave
 
Getting an undefined function error with that code, too.
 
This syntax assumes ParticipantPicker is an open form and a ComboBox on this form is named Combo58. It *is* the correct syntax.
 
Then I have something else the matter. That is the syntax I thought woukld work, too...
 
Not sure why, but I went in to SQL view and tweaked it a little, and it now runs fine :)
SQL+
SELECT tblEnrollment.[Name/Type], tblEnrollment.Cred, tblEnrollment.Specialty, tblEnrollment.Address, tblEnrollment.Phone, tblEnrollment.Sem, tblEnrollment.SemDate, tblEnrollment.SemYear, tblEnrollment.Location, tblEnrollment.Hours, tblEnrollment.Cost, tblEnrollment.Pd, tblEnrollment.AmountPD, tblEnrollment.attend, tblEnrollment.PID, tblEnrollment.RecSource, tblEnrollment.SID
FROM tblEnrollment
WHERE (((tblEnrollment.[Name/Type])=[Forms]![ParticipantPicker]![Combo0]));

Not how I wanted to, but it works :)

Thanks,
Dave
 

Users who are viewing this thread

Back
Top Bottom