Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / September 2007

Tip: Looking for answers? Try searching our database.

Suspicious SQL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 17 Sep 2007 21:03 GMT
Where does one put the IN part for this SQL statement.
Right after the INSERT or where it is now?
It doesn't look right to me.
Also the  ending doesn't look good either.
Thanks
DS

NEWSQL = "INSERT INTO tblChartOfAccounts " & _
"(ChartID,ChartName,ChartNumber) IN '" & C:\Red\Reddy.mdb & "' " & _
"Values(" & Forms!frmBSChartOfAccounts!TxtNewID & ", " & _
"" & Chr(34) & Forms!frmBSChartOfAccounts!TxtName & Chr(34) & ", " & _
"" & Format(Forms!frmBSChartOfAccounts!TxtNumber & ")")
DS - 17 Sep 2007 22:09 GMT
OK This seems to work....

If Len(REDACT()) > 0 Then
            Me.TxtNewID = Nz(DMax("IDNumber", "Table1"), 0) + 1
            DoCmd.SetWarnings False
            NewSQL = "INSERT INTO Table1 " & _
            "(IDNumber,IDName,IDName2) IN '" & REDACT() & "' " & _
            "Values(" & Forms!Form1!TxtNewID & ", " & _
            "'" & Forms!Form1!TxtInfo & "', " & _
            "'" & Forms!Form1!TxtInfo2 & "');"
            DoCmd.RunSQL (NewSQL)
            DoCmd.SetWarnings True
            Else
            End If

Is the Syntax OK?
DS
Arvin Meyer [MVP] - 17 Sep 2007 22:13 GMT
What is REDACT()? Does it return what you expect?

Try it on test data. That's the way to tell for sure.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> OK This seems to work....
>
[quoted text clipped - 13 lines]
> Is the Syntax OK?
> DS
DS - 18 Sep 2007 02:19 GMT
> What is REDACT()? Does it return what you expect?
>
> Try it on test data. That's the way to tell for sure.
It returns the path to the external database.  And yes it does work.
I'm more concerned about the end of the statement.  ;
Thanks
DS
AccessVandal - 18 Sep 2007 03:42 GMT
Hi DS,

Here's from Help.

IN Clause
Identifies tables in any external database to which the Microsoft Jet
database engine can connect, such as a dBASE or Paradox database or an
external Microsoft® Jet database.

Syntax
To identify a destination table:

[SELECT | INSERT] INTO destination IN
   {path | ["path" "type"] | ["" [type; DATABASE = path]]}

To identify a source table:

FROM tableexpression IN
   {path | ["path" "type"] | ["" [type; DATABASE = path]]}

A SELECT statement containing an IN clause has these parts:

Part Description
destination The name of the external table into which data is inserted.
tableexpression The name of the table or tables from which data is retrieved.
This argument can be a single table name, a saved query, or a compound
resulting from an INNER JOIN, LEFT JOIN, or RIGHT JOIN.
path The full path for the directory or file containing table.
type The name of the database type used to create table if a database is not
a Microsoft Jet database (for example, dBASE III, dBASE IV, Paradox 3.x, or
Paradox 4.x).

Remarks
You can use IN to connect to only one external database at a time.

In some cases, the path argument refers to the directory containing the
database files. For example, when working with dBASE, Microsoft FoxPro®, or
Paradox database tables, the path argument specifies the directory containing
.dbf or .db files. The table file name is derived from the destination or
tableexpression argument.

To specify a non-Microsoft Jet database, append a semicolon (;) to the name,
and enclose it in single (' ') or double (" ") quotation marks. For example,
either 'dBASE IV;' or "dBASE IV;" is acceptable.

You can also use the DATABASE reserved word to specify the external database.
For example, the following lines specify the same table:

... FROM Table IN "" [dBASE IV; DATABASE=C:\DBASE\DATA\SALES;];

... FROM Table IN "C:\DBASE\DATA\SALES" "dBASE IV;"

------------------------------------------------------------------------------
--

Notes

For improved performance and ease of use, use a linked table instead of IN.

You can also use the IN reserved word as a comparison operator in an
expression. For more information, see the In operator.

>DS wrote:
>> What is REDACT()? Does it return what you expect?
[quoted text clipped - 4 lines]
>Thanks
>DS

Signature

Please Rate the posting if helps you

DS - 18 Sep 2007 12:23 GMT
Wow, thank you that was and is very informative.  I'm going to keep this
info for future reference. It explains a lot!
DS
John W. Vinson - 18 Sep 2007 19:46 GMT
>Wow, thank you that was and is very informative.  I'm going to keep this
>info for future reference. It explains a lot!
>DS

Note that he did say it's from the Help. You don't need to keep a second
copy... it's only a click of F1 and a search away.

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.