I just want to verify that the form is open and the value is in the control
listed in the parameter (if the form isn't open, it won't work). Also, that
you did change the names in what I typed to the actual names of your form
and control.
What type of control is it? If it is a multicolumn control, such as a
listbox or combo box, the value comes from the bound column. To get the
value of a different column, you have to specify which column you want it
from. If it is a listbox, is the listbox set for Simple or Extended
multi-select? If so, then more work will need to be done. The "value" of a
multi-select listbox is gotten differently.
Did you read the information in the web link supplied in my 2nd reply?
What happens if you wrap the second "[Guid]" with Cstr?
WHERE GroupId = CStr([Forms]![frmFormName]![ctlControlName])
or
WHERE CStr([GroupId]) = CStr([Forms]![frmFormName]![ctlControlName])
Have you tried rewriting the query in the AfterUpdate event of the control
that you enter the GUID?
Example:
strSQL = "SELECT Person.Id, [LastName] & ", " & [FirstName] AS FileAs" & _
" FROM Person" & _
" WHERE (((Person.Id) Not In (SELECT PersonId FROM GroupPerson WHERE
GroupId" & _
"=" & Me.ctrControlName & ")))" & _
" ORDER BY Person.LastName, Person.FirstName;"
CurrentDb.QueryDefs("qryNameOfQuery").SQL = strSQL
There will be no need for a "parameter" because you will be placing the
value directly in the WHERE clause.
--
Wayne Morgan
MS Access MVP
Craig Buchanan said:
wayne-
With what you have, if you open the query by double clicking it in the
Queries window it should prompt you for [Guid]. If you type it in, does
it work? works
To point it to a value in a control on a form you would replace [Guid]
(in both locations) with [Forms]![frmFormName]![ctlControlName]
doesn't work