SQL Pass-thru query

E

Eva Shanley

Can you include a prompt for a date in a pass-thru query,
and if so how do you code it? Thanks!
 
C

Cameron Sutherland

Speaking of 'code it' why not do it all in code?

Private Sub Command0_Click()
Dim strInput as string
strInput=InputBox("Whatever prompt")
'Error check input here, IsDate, IsNull, IsNumeric...
DoCmd.RunSQL "INSERT ... WHERE [x]='" & strInput & "'" , -1
End Sub

The -1 tells it to make the query a pass-through.

-Cameron Sutherland
 
D

Duane Hookom

Not sure where you got that information but the -1 makes the query
transactional.
I create a standard pass-through and then use DAO code to change the SQL of
the QueryDef. This allows you to create any legitimate SQL statement and
assign it to an existing P-T.

--
Duane Hookom
MS Access MVP


Cameron Sutherland said:
Speaking of 'code it' why not do it all in code?

Private Sub Command0_Click()
Dim strInput as string
strInput=InputBox("Whatever prompt")
'Error check input here, IsDate, IsNull, IsNumeric...
DoCmd.RunSQL "INSERT ... WHERE [x]='" & strInput & "'" , -1
End Sub

The -1 tells it to make the query a pass-through.

-Cameron Sutherland
-----Original Message-----
Can you include a prompt for a date in a pass-thru query,
and if so how do you code it? Thanks!
.
 

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