RE: ODBCDirect Workspace

Tech-Archive recommends: Fix windows errors by optimizing your registry



Rob,

Are you using one Access database to work inside of another Access database?

Are you using ADO to hit a SQL server?

I am trying to understand why you would be using ODBCDirectWorkspace...

The following is a simple DAO version of what I think you are trying to do.
____________________________________________________________
Private Sub LoadComboBox_DAO()
Dim daoDbs As DAO.Database
Dim daoQdf As DAO.QueryDef
Dim strSql As String
Set daoDbs = CodeDb
strSql = "SELECT EmployeeID, [FirstName] & SPACE(1) & [LastName] As NAME
FROM dbo_tblEmployees;"
Set daoQdf = daoDbs.CreateQueryDef("MyNewQry")
daoQdf.sql = strSql
strSql = ""
daoQdf.Close
daoDbs.Close
Set daoQdf = Nothing
Set daoDbs = Nothing
Me.cboMyBox.RowSource = "Select * from MyNewQry Order By Name;"
Me.Requery
Me.Repaint
Me.cboMyBox.SetFocus
End Sub
___________________________________________________________

However if you are going to be using this query again to populate the combo
box
you may not want to destroy and recreate it over and over. It may be better
to
just change the SQL of the query rather than create it repeatedly. And on
another thought do you realy need the query at all? What purpose does
creating this query serve? You can simply feed the results of your SQL
directly into the object.
________________________________________________________________
Private Sub LoadComboBox_SQL()
Me.cboMyBox.RowSource = "SELECT EmployeeID, [FirstName] & SPACE(1) &
[LastName] FROM dbo_tblEmployees Order By FirstName;"
Me.Requery
Me.Repaint
Me.cboMyBox.SetFocus
End Sub
________________________________________________________________
--
~ SPARKER ~


"Rob M" wrote:

If I create a ODBCDirect Workspace object, and then a Connection object, and
then a QueryDefinition, I am unable to use the query that has been created as
the RowSource for a ComboBox. The ComboBox doesn't recognize that the query
exists. Am I doing something wrong, or is this just not possible? Thanks
for helping.
.



Relevant Pages

  • RE: ODBCDirect Workspace
    ... successfully ported my tables to SQL Server and have created an Access ... Are you using one Access database to work inside of another Access database? ... Set daoDbs = Nothing ... However if you are going to be using this query again to populate the combo ...
    (microsoft.public.access.modulesdaovba)
  • Re: Operator in SQL like "Like"
    ... I have an Access database with a table called "product". ... The SQL that Access gives me for the query I am trying ... All of the operators used in Microsoft Jet SQL ... So it may be that the Like operator for Access SQL cannot be used in Delphi. ...
    (microsoft.public.access.modulesdaovba)
  • ANSI defaults, Linked Server
    ... Access database that our Credit Card processing software uses. ... written a SP to grab some data from this Linked Server, and from my local SQL ... Enable these options and the reissue your query" ...
    (microsoft.public.sqlserver.programming)
  • Re: Running a Query
    ... in your "code" (it's called a SQL statement, ... query in design view. ... the SQL is presented in the query grid. ... >> is the Members table in the Access database where you're building the ...
    (microsoft.public.access.queries)
  • Pass-Through, Default DSN?
    ... I am converting my companies Access database to SQL ... as a front end to connect to SQL Server. ... Through query so it connects to the ODBC to run the query, ...
    (microsoft.public.access.queries)