[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Executing a query in Access from VB

Experts,

I have a command "Append_OTC".  What is the syntax to execute this command from VB?
0
morinia
Asked:
morinia
  • 2
  • 2
1 Solution
 
pdebaetsCommented:
docmd.openquery "Append_OTC"
0
 
moriniaAdvanced Analytics AnalystAuthor Commented:
I am sorry I did not mention the query is creating a table.  I get this error

Compile error:  argument not Optional

SELECT * INTO ALL_CLAIMS
FROM ALL_HCS_CLAIM
WHERE CLAIM_STATUS IN ('VHPA', 'VCB2')
ORDER BY SALV_OPERATOR;
0
 
pdebaetsCommented:
What line of code is highlighted when you get the compile error?
0
 
SheilsCommented:
To execute an append query you can use

Currentdb.Execute "Append_OTC" , dbFailOnError
0
 
SheilsCommented:
You can also pass the sql

Dim strSQL as string

strSQL="SELECT * INTO ALL_CLAIMS FROM ALL_HCS_CLAIM WHERE CLAIM_STATUS IN ('VHPA', 'VCB2') ORDER BY SALV_OPERATOR"

Currentdb.Execute strSQL , dbFailOnError
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now