Re: running a make table query in an access database from VB

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Earl,

Here is an example how to call the query against Access database. There is
only one suggestion here: inside of the example, you will see that ADO
returns recordset, but if you need just to call an action query, then
replace next code

Set Rs1 = Cmd1.Execute()

with

Cmd1.Execute()

It will execute the query, but will not return the recordset. You could
actually delete the whole recordset declaration part, because you do not
need it

--
Val Mazur
Microsoft MVP

http://xport.mvps.org



"Earl Takasaki" <EarlTakasaki@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6FE56331-97DC-4BAE-B1C5-9A8D8EF0AB33@xxxxxxxxxxxxxxxx
> Hi:
>
> I am a newbie VB programmer. I have an access database (MyDatabase.mdb),
> but
> cannot assume that Access.exe is available. Within this database there is
> a
> "make-table" query called "MakeTable1." The SQL for this table is simply
> "SELECT * INTO Table1 FROM Query1" where Query1 is an existing query in
> the
> db.
>
> What I would like to do is simply "execute" the MakeTable1 query (or
> alternatively, execute the SQL statement "SELECT * INTO Table1 from
> Query1")
> from VB. I don't need to put recordsets or anything like that -- just need
> to
> automate the make-table query and Table1 created (or recreated) on
> command
> from VB code. I'm sure this is really simple, but I am a little lost. Can
> someone help me with a code sample?
>
> Best,
>
> --
> Earl Takasaki
> Master of Financial Engineering Candidate
> University of California at Berkeley


.



Relevant Pages

  • RE: Query on Date range does not qualify the Year
    ... problem since it means that the column MUST be a text field for ADO purposes. ... recordset once you have retrieved it. ... you should be able to sort accurately by the NEW date field. ... > So what is happening is that Excel during the query determines the data type ...
    (microsoft.public.excel.programming)
  • ~~~~~~~~~~~~~ MS ACCESS ~~~~~~~~~~~~~
    ... accdbman ms access database query table ... age bracket ms access report ... buy ms access download full version ...
    (comp.mail.pine)
  • RE: Problem using COMPUTE with SPROC on ADO connection
    ... This question is better asked in a traditional ADO group or the SQL Server ... When you contact a sproc in Query Analyzer, any items, like your COMPUTE ... placed in a seaparate Recordset, and you will have to get next to retrieve it. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: VB code to perform custom query of MS access table and display alert
    ... A more elegant approach requires the use of a recordset, ... >I have a MS access database which has entries (each of which has a name ... >field) and uses a form to make new entries. ... >query (it is possible to have more than 1 record in the table to have ...
    (comp.databases.ms-access)
  • Re: ADO to get Access query results
    ... whether a recordset created by using the Execute method of a Command object ... the reference in the query to the Access form control is never ... Dim objRecordset As ADODB.Recordset ... >>> get the results of the "top level" select query into an ADO recordset. ...
    (microsoft.public.data.ado)