By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

Help With BuildSQL() Statement please

P: n/a
Can someone help me with a BuildSQL Statement:

This code works:

DDEExecute Chan, "[BuildSQL()]" 'clear any sql's
DDEExecute Chan, "[BuildSQL('SELECT LNTABLE.M_LN_POLICY_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_1, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_2, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_3, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_4, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESSEE, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_PHONE_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_RESIDENCE_STATE ')]"
DDEExecute Chan, "[BuildSQL('FROM SYSDBA.LCTABLE LCTABLE,
SYSDBA.LNTABLE LNTABLE ')]"
DDEExecute Chan, "[BuildSQL('WHERE LNTABLE.M_LN_CLIENT_REFERENCE =
LCTABLE.M_LC_CLIENT_REFERENCE ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_POLICY_OWNER='Y' ')]"
DDEExecute Chan, "[BuildSQL('AND LCTABLE.M_LC_DELIVERY='RR' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_POLICY_NUMBER='Z223' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_PRINCIPAL_LIFE='Y'')]"

DDEExecute Chan, "[QueryNow()]"

However I want the Policy Number to come from a unbound text box on the
form so that a user can search on the policy number. Here is the code
I used:

DDEExecute Chan, "[BuildSQL()]" 'clear any sql's
DDEExecute Chan, "[BuildSQL('SELECT LNTABLE.M_LN_POLICY_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_1, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_2, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_3, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_4, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESSEE, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_PHONE_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_RESIDENCE_STATE ')]"
DDEExecute Chan, "[BuildSQL('FROM SYSDBA.LCTABLE LCTABLE,
SYSDBA.LNTABLE LNTABLE ')]"
DDEExecute Chan, "[BuildSQL('WHERE LNTABLE.M_LN_CLIENT_REFERENCE =
LCTABLE.M_LC_CLIENT_REFERENCE ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_POLICY_OWNER='Y' ')]"
DDEExecute Chan, "[BuildSQL('AND LCTABLE.M_LC_DELIVERY='RR' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_POLICY_NUMBER=" &
Me.PolNum & " ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_PRINCIPAL_LIFE='Y'')]"


DDEExecute Chan, "[QueryNow()]"

I am getting a runtime 285 error, "The other application cannot perform
the DDE function you attempted"

Everything is the same, just that I replaced the policy number line to
refer to a control on the form rather than having a static number in
there.

Thanks in advance!

-Brian

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"BerkshireGuy" <bd*****@yahoo.com> wrote in message
news:11********************@f14g2000cwb.googlegrou ps.com...
Can someone help me with a BuildSQL Statement:

This code works:

DDEExecute Chan, "[BuildSQL()]" 'clear any sql's
DDEExecute Chan, "[BuildSQL('SELECT LNTABLE.M_LN_POLICY_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_1, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_2, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_3, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_4, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESSEE, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_PHONE_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_RESIDENCE_STATE ')]"
DDEExecute Chan, "[BuildSQL('FROM SYSDBA.LCTABLE LCTABLE,
SYSDBA.LNTABLE LNTABLE ')]"
DDEExecute Chan, "[BuildSQL('WHERE LNTABLE.M_LN_CLIENT_REFERENCE =
LCTABLE.M_LC_CLIENT_REFERENCE ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_POLICY_OWNER='Y' ')]"
DDEExecute Chan, "[BuildSQL('AND LCTABLE.M_LC_DELIVERY='RR' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_POLICY_NUMBER='Z223' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_PRINCIPAL_LIFE='Y'')]"

DDEExecute Chan, "[QueryNow()]"

However I want the Policy Number to come from a unbound text box on the
form so that a user can search on the policy number. Here is the code
I used:

DDEExecute Chan, "[BuildSQL()]" 'clear any sql's
DDEExecute Chan, "[BuildSQL('SELECT LNTABLE.M_LN_POLICY_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_1, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_2, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_3, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESS_LINE_4, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_ADDRESSEE, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_PHONE_NUMBER, ')]"
DDEExecute Chan, "[BuildSQL('LCTABLE.M_LC_RESIDENCE_STATE ')]"
DDEExecute Chan, "[BuildSQL('FROM SYSDBA.LCTABLE LCTABLE,
SYSDBA.LNTABLE LNTABLE ')]"
DDEExecute Chan, "[BuildSQL('WHERE LNTABLE.M_LN_CLIENT_REFERENCE =
LCTABLE.M_LC_CLIENT_REFERENCE ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_POLICY_OWNER='Y' ')]"
DDEExecute Chan, "[BuildSQL('AND LCTABLE.M_LC_DELIVERY='RR' ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_POLICY_NUMBER=" &
Me.PolNum & " ')]"
DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_IF_PRINCIPAL_LIFE='Y'')]"


DDEExecute Chan, "[QueryNow()]"

I am getting a runtime 285 error, "The other application cannot perform
the DDE function you attempted"

Everything is the same, just that I replaced the policy number line to
refer to a control on the form rather than having a static number in
there.

Thanks in advance!

-Brian


Despite its name, M_LN_POLICY_NUMBER is a string, not a number. To assign
it a value, you'll need to surrround the value with quotes. I've never used
DDEExecute, but I'd guess something like this:

DDEExecute Chan, "[BuildSQL('AND LNTABLE.M_LN_POLICY_NUMBER='" &
Me.PolNum & "' ')]"

Nov 13 '05 #2

P: n/a
Perfect! Grrr I hate syntax!

Thank you Randy!

Anyone have a good site that has lots of syntax examples?

Thanks!
Brian

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.