set unbound control value with VBA

F

Francis

Hello i need to write in VBA the following:


On Form Current Event i need the unbound combobox: comboAgent to assume
the
value obtained with the followig query (it only outputs one record so
its ok)
SELECT Agent_Table.agent
FROM Agent_Table, AgentSegment_Table
WHERE (Agent_Table.agentID = AgentSegment_Table.agentID) AND
(AgentSegment_Table.agentsegmentID = [Forms]![ARM]![comboSegment])


I think it will be needed to use the query method but i'm not familiar
with DataFactory and RDS (Remote Data Server) languages, if possible
try to use the more simple method to accomplish what i said previuosly
ok.


thanks in advance.
Francisco (Portugal)
 
J

John Vinson

Hello i need to write in VBA the following:


On Form Current Event i need the unbound combobox: comboAgent to assume
the
value obtained with the followig query (it only outputs one record so
its ok)
SELECT Agent_Table.agent
FROM Agent_Table, AgentSegment_Table
WHERE (Agent_Table.agentID = AgentSegment_Table.agentID) AND
(AgentSegment_Table.agentsegmentID = [Forms]![ARM]![comboSegment])

Save this query as qryAgent; then set the textbox's Control Source
property to

=DLookUp("[Agent]", "[qryAgent]")
I think it will be needed to use the query method but i'm not familiar
with DataFactory and RDS (Remote Data Server) languages, if possible
try to use the more simple method to accomplish what i said previuosly
ok.

I'm unfamiliar with these languages, and they are *not* part of
Access... why do you bring them up??

John W. Vinson[MVP]
 
F

Francis

Well just make a search in Help within VBA of access, to the search
word "query method". And you will see a lot of references to that,
namely in the Query method:

Stumbled on it when i was looking for a way to implement an SQL in a
variable in VBA:

RDS 2.5 API Reference
*Query Method*
Uses a valid SQL query string to return a Recordset
Set Recordset = DataFactory.Query(Connection, Query)

Regarding your solution, thanks it is sorted already
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top