R
Ross
This question (what I want to do) is simple but I am giving a complete
description.
I am in the QBE grid and switch to SQL view. When this view opens, it
automatically highlights the SQL from my query.
This is what I would like to do:
1. Copy the highlighted SQL to my clipboard.
2. Open a table called tblSQLStore
3. Then Paste this SQL into a field (the only field) in this table
4. Close the table.
This is the code that I fire from a hotkey ({F7}):
'*********************
Public Function Set_Up_SQL()
'**********************
Dim strsql As String
'3. Copy in SQL
SendKeys "^c", True
'1. Empty
strsql = "DELETE tblSQLStore.SQL "
strsql = strsql & "FROM tblSQLStore;"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings True
'2. Open table
DoCmd.OpenTable ("tblSQLStore")
'3. Paste in SQL
SendKeys "^v", True
'4. Close Table
'DoCmd.Close acTable, ("tblSQLstore")
End Function
This code has worked precisely the way that I want for a years and now, is
no longer working. However, it does works on some machines, particularly
without wireless keyboards and mouse. I love my wireless keyboard and mouse.
I can’t believe that that may be the issue but it might.
The reason that I paste into the field (which is memo) is that this
preserves that format which is essential to my purpose.
ie
SELECT tblVersion.VersionNo
FROM tblVersion
ORDER BY tblVersion.VersionNo DESC;
Is there a better, more reliable way to do this? Suggestions?
description.
I am in the QBE grid and switch to SQL view. When this view opens, it
automatically highlights the SQL from my query.
This is what I would like to do:
1. Copy the highlighted SQL to my clipboard.
2. Open a table called tblSQLStore
3. Then Paste this SQL into a field (the only field) in this table
4. Close the table.
This is the code that I fire from a hotkey ({F7}):
'*********************
Public Function Set_Up_SQL()
'**********************
Dim strsql As String
'3. Copy in SQL
SendKeys "^c", True
'1. Empty
strsql = "DELETE tblSQLStore.SQL "
strsql = strsql & "FROM tblSQLStore;"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings True
'2. Open table
DoCmd.OpenTable ("tblSQLStore")
'3. Paste in SQL
SendKeys "^v", True
'4. Close Table
'DoCmd.Close acTable, ("tblSQLstore")
End Function
This code has worked precisely the way that I want for a years and now, is
no longer working. However, it does works on some machines, particularly
without wireless keyboards and mouse. I love my wireless keyboard and mouse.
I can’t believe that that may be the issue but it might.
The reason that I paste into the field (which is memo) is that this
preserves that format which is essential to my purpose.
ie
SELECT tblVersion.VersionNo
FROM tblVersion
ORDER BY tblVersion.VersionNo DESC;
Is there a better, more reliable way to do this? Suggestions?