开发者

A macro to convert a SQL query to a string concatenation and viceversa?

I'm working with Access and I have many queries in the code like

"SELECT something, something " _
& "FROM the_table " _
& "WHERE something Is Null "

or

"SELECT " & _
  "Min(something), " & _
  "Max(something2) " & _
"FROM (the_table " & _
      "INNER JOIN another_table ON sm1 = sm2) " & _
"WHERE sm3 is not null " & _
      "AND sm4 = " & Me.plan

I want to do a macro t开发者_如何学JAVAhat converts theses string to executable queries (delete initial quotes and final quotes, ampersands and undescores) and viceversa, convert queries to a string concatenation.

Example output would be:

SELECT
  Min(something),
  Max(something2)
FROM (the_table
      INNER JOIN another_table ON sm1 = sm2)
WHERE sm3 is not null
      AND sm4 = Me.plan

I don't know how to google this :S cause I'm asking.

I know how to record Macros on TextMate or similar, but I'm not familiar with it and I need some help.

Any tips? Thanks :-)


You can probably use DoCmd.RunSQL myString command.

See here and there for more valuable information

Btw, here is the Google Search you could have done: http://tinyurl.com/3apsala

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜