Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: SQL String amendment


Message #1 by "Tim Maher" <tim.maher@s...> on Mon, 16 Dec 2002 11:25:45 +0000
HI,

I have following SQL Execute statement :

dbx.Execute " INSERT INTO patients_changed_address SELECT * FROM
twtext2 WHERE [Med Rec No] =" & [Forms]![op_response2]![Med Rec No] &
";"

Due to my "lack of experience" I need to add another criteria to this 

"AND [OP Referral Date] =  [Forms]![op_response2]![OP Referral Date] "

Any help on this would be appreciated.

Many Thanks

Tim

Message #2 by "Gregory Serrano" <SerranoG@m...> on Mon, 16 Dec 2002 13:28:23
Tim,

Assuming [Med Rec No] is a number and [OP Referral Date] is a date:

dbx.Execute "INSERT INTO patients_changed_address SELECT * FROM twtext2 
WHERE [Med Rec No] = " & Forms.op_response2.Form.[Med Rec No] & " AND [OP 
Referral Date] = #" & Forms.op_response2.Form.[OP Referral Date] & "#;"

Greg
Message #3 by "bwarehouse" <bwarehouse@y...> on Mon, 16 Dec 2002 12:10:09 -0700
Try this:

dbx.Execute "INSERT INTO patients_changed_address SELECT * FROM " _
& "twtext2 WHERE [Med Rec No] = [Forms]![op_response2]![Med Rec No] And " _
& "[OP Referral Date] = [Forms]![op_response2]![OP Referral Date];"


later,
bware
-----Original Message-----
From: Tim Maher [mailto:tim.maher@s...]
Sent: Monday, December 16, 2002 4:26 AM
To: Access
Subject: [access] SQL String amendment

HI,

I have following SQL Execute statement :

dbx.Execute " INSERT INTO patients_changed_address SELECT * FROM
twtext2 WHERE [Med Rec No] =" & [Forms]![op_response2]![Med Rec No] &
";"

Due to my "lack of experience" I need to add another criteria to this

"AND [OP Referral Date] =  [Forms]![op_response2]![OP Referral Date] "

Any help on this would be appreciated.

Many Thanks

Tim





  Return to Index