D
Dave Birley
I've got some code that works (yeah, really!) that I want to use in my After
Change of a ComboBox. It defines a Query that looks at the result of the
changed Combobox and of an unbound List box (containing only three items),
and then filters the main data based on those two factors.
I have my code set up as
dim SQL as string
SQL = "SELECT Company.CompanyID, Payload.PayloadID, Item.Item,
Item.Reference_Address"
SQL = SQL + " FROM Company INNER JOIN (([Group] INNER JOIN Item ON
Group.GroupID = Item.GroupID) INNER JOIN Payload ON Group.PayloadID =
Payload.PayloadID) ON Company.CompanyID = Group.CompanyID "
SQL = SQL + " WHERE Group.CompanyID = Me.Payload.Form.cboCOmpany.CompanyID,
Group.PayloadID = Me.[Payload Subform].PayloadID "
SQL = SQL + " ORDER BY Item.Item;"
Me![Group Subform].Item.ControlSource = SQL
...where Item is the textbox on the Group Subform. Candidly I'd prefer to
make the Query I'm generating be the ControlSource for the whole Subform, but
I'll take what I can get. The code as I present it does not work --
obviously, or I wouldn't be here asking. One thought that occurs to me is to
make the SQL in the form of..
SELECT <blah> from <Blahblah> as <MyQuery>
...but I just don't know enough about SQL as Access uses it.
Your assistance is solicited.
Change of a ComboBox. It defines a Query that looks at the result of the
changed Combobox and of an unbound List box (containing only three items),
and then filters the main data based on those two factors.
I have my code set up as
dim SQL as string
SQL = "SELECT Company.CompanyID, Payload.PayloadID, Item.Item,
Item.Reference_Address"
SQL = SQL + " FROM Company INNER JOIN (([Group] INNER JOIN Item ON
Group.GroupID = Item.GroupID) INNER JOIN Payload ON Group.PayloadID =
Payload.PayloadID) ON Company.CompanyID = Group.CompanyID "
SQL = SQL + " WHERE Group.CompanyID = Me.Payload.Form.cboCOmpany.CompanyID,
Group.PayloadID = Me.[Payload Subform].PayloadID "
SQL = SQL + " ORDER BY Item.Item;"
Me![Group Subform].Item.ControlSource = SQL
...where Item is the textbox on the Group Subform. Candidly I'd prefer to
make the Query I'm generating be the ControlSource for the whole Subform, but
I'll take what I can get. The code as I present it does not work --
obviously, or I wouldn't be here asking. One thought that occurs to me is to
make the SQL in the form of..
SELECT <blah> from <Blahblah> as <MyQuery>
...but I just don't know enough about SQL as Access uses it.
Your assistance is solicited.