VBSCRIPT Import CSV File Change Data Type

  • Thread starter Darryl Brooks via AccessMonster.com
  • Start date
D

Darryl Brooks via AccessMonster.com

Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.

B)The make table query method does import the data but our IP Address field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
J

John Nurick

Hi Darryl,

When you SELECT * from a text file without a header row (i.e. HDR=No) Jet
assigns field names F1, F2.... You need to alias those to the actual names
in your table:
SELECT
F1 AS UserIPAddress,
F2 AS UserName,
...
In general it's preferable to create your table first with the correct field
types (AFAIK you can do this by having your VBScript execute a CREATE TABLE
query). But you could try to coerce the IP address to a string with
F1 & "" AS UserIPAddress
or
CStr(F1) AS UserIPAddress
..

Darryl Brooks via AccessMonster.com said:
Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.

B)The make table query method does import the data but our IP Address
field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
G

Guest

You can set up an import specification for a .cvs file.
File->Get External DAte->Import
In the import wizard, select text files, the select the file to import.
Then click on Advanced. You can then define exactly how you want the
formatting for the import. Give the spec a name and use it with the
TransferText method.

Darryl Brooks via AccessMonster.com said:
Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.

B)The make table query method does import the data but our IP Address field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
J

John Nurick

TransferText is only available in Access.

You can set up an import specification for a .cvs file.
File->Get External DAte->Import
In the import wizard, select text files, the select the file to import.
Then click on Advanced. You can then define exactly how you want the
formatting for the import. Give the spec a name and use it with the
TransferText method.

Darryl Brooks via AccessMonster.com said:
Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.

B)The make table query method does import the data but our IP Address field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
G

Guest

He said he is importing it into access. He did say VB Script, but with the
common misuse of terminology here, it is not always easy to tell what people
are really asking.

John Nurick said:
TransferText is only available in Access.

You can set up an import specification for a .cvs file.
File->Get External DAte->Import
In the import wizard, select text files, the select the file to import.
Then click on Advanced. You can then define exactly how you want the
formatting for the import. Give the spec a name and use it with the
TransferText method.

Darryl Brooks via AccessMonster.com said:
Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.

B)The make table query method does import the data but our IP Address field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
6

'69 Camaro

Hi, Klatuu.
He did say VB Script, but with the
common misuse of terminology here, it is not always easy to tell what
people
are really asking.

You needn't worry that Darryl Brooks is misusing the VBScript terminology.
For future reference, the following were clues and a dead giveaway that
Darryl does indeed mean VBScript, not VBA:

1.) Notice the desire to avoid using Access:

2.) Notice that there are no explicit data types in these variable
declarations, since VBScript only has one data type, the Variant:

3.) Notice the VBScript syntax to write to the current HTTP output for the
Web client by using markup language syntax (HTML):

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)


Klatuu said:
He said he is importing it into access. He did say VB Script, but with
the
common misuse of terminology here, it is not always easy to tell what
people
are really asking.

John Nurick said:
TransferText is only available in Access.

You can set up an import specification for a .cvs file.
File->Get External DAte->Import
In the import wizard, select text files, the select the file to import.
Then click on Advanced. You can then define exactly how you want the
formatting for the import. Give the spec a name and use it with the
TransferText method.

:

Hi

We are trying to utilize a VB Script to import a (IIS file) CVS file
into
an MS Access Database (Ver.2002 SP3) table without opening the
database.

A)We have tried the "make table query method" and the "append query
method".


We utilize the following "append query" SQL string:

strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

The following error message is received:

The INSERT INTO statement contains the following unknown field
name:"F1":
Make sure you have typed the name correctly, and try the operation
again.

B)The make table query method does import the data but our IP Address
field
is converted to a currency field.

'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"


Question: How do we control the Microsoft Jet Engine with a "Make
Table
query" to specify field data type during import?



CODE UTILIZED:

dim oJet
dim oDB
dim strSQL
dim rs

Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""

'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"

'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"

oDB.Execute strSQL

oDB.Close

Thank You
DB
 
6

'69 Camaro

Hi, John.
Also this:

This line of code also runs in VBA, so I can't claim that it's a clue that
the code is VBScript.

This line of code _is_ a dead giveaway for something else which indicates
it's VBScript, but I can't really expect Klatuu to know that, since Klatuu
has only been answering questions in the Access newsgroups for more than a
month.

Whenever one arrives at a new IT department, one can do a little research to
discover who the coders are -- and who will never be a coder. Likewise, one
can tell who the best coders are -- and which coders never will be the best.
The best coders write code that avoids bugs and makes bugs obvious, and code
clarity takes precedence over brevity. Such techniques develop into a
coding style that can be easily recognized, even when the author's name
doesn't accompany the code.

A VBScripter would have written:

Set oConn = CreateObject("ADODB.Connection")

.... because he knows he needs to connect to a database before doing the
database work.

A VB programmer or newer Access VBA programmer would have written:

Set objConnection = CreateObject("ADODB.Connection")
or
Set objConn = CreateObject("ADODB.Connection")

.... because he knows he needs a connection object instantiated before doing
the database work.

A more experienced Access VBA programmer would have written:

Set dbe = CreateObject("DAO.DBEngine.36")
or
Set engine = CreateObject("DAO.DBEngine.36")
or
Set DBEng = CreateObject("DAO.DBEngine.36")

.... because he knows he needs a database engine to do the database work.

But whenever one sees the following line of code:

Set oJet = CreateObject("DAO.DBEngine.36")

.... it's very clear that the original author knows he needs Jet to do the
database work, and that he has to instantiate the object before doing so.

This line of code is a dead giveaway that the code is VBScript written by
none other than John Nurick -- or else borrowed from one of your VBScript
examples (or Ronny Ong's single example a few years ago), because this is
your coding style. Other lines of code will help distinguish whether the
code was borrowed from one of your examples or Ronny Ong's example.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)
 
J

John Nurick

Hi Gunny,

That's what I call subtle reasoning<g>.

Hi, John.
Also this:

This line of code also runs in VBA, so I can't claim that it's a clue that
the code is VBScript.

This line of code _is_ a dead giveaway for something else which indicates
it's VBScript, but I can't really expect Klatuu to know that, since Klatuu
has only been answering questions in the Access newsgroups for more than a
month.

Whenever one arrives at a new IT department, one can do a little research to
discover who the coders are -- and who will never be a coder. Likewise, one
can tell who the best coders are -- and which coders never will be the best.
The best coders write code that avoids bugs and makes bugs obvious, and code
clarity takes precedence over brevity. Such techniques develop into a
coding style that can be easily recognized, even when the author's name
doesn't accompany the code.

A VBScripter would have written:

Set oConn = CreateObject("ADODB.Connection")

... because he knows he needs to connect to a database before doing the
database work.

A VB programmer or newer Access VBA programmer would have written:

Set objConnection = CreateObject("ADODB.Connection")
or
Set objConn = CreateObject("ADODB.Connection")

... because he knows he needs a connection object instantiated before doing
the database work.

A more experienced Access VBA programmer would have written:

Set dbe = CreateObject("DAO.DBEngine.36")
or
Set engine = CreateObject("DAO.DBEngine.36")
or
Set DBEng = CreateObject("DAO.DBEngine.36")

... because he knows he needs a database engine to do the database work.

But whenever one sees the following line of code:

Set oJet = CreateObject("DAO.DBEngine.36")

... it's very clear that the original author knows he needs Jet to do the
database work, and that he has to instantiate the object before doing so.

This line of code is a dead giveaway that the code is VBScript written by
none other than John Nurick -- or else borrowed from one of your VBScript
examples (or Ronny Ong's single example a few years ago), because this is
your coding style. Other lines of code will help distinguish whether the
code was borrowed from one of your examples or Ronny Ong's example.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)
 
G

Guest

I consider your comment rude. So I misunderstood the question. Am I the
only one out here who ever made a mistake. Okay, so I have ony been
answering questions for a month or so; however, I have been programming in
multiple languages and platforms for only 28 years and only the last 5 in
Access. I guess I'm just an ignorant novice.

'69 Camaro said:
Hi, John.
Also this:

This line of code also runs in VBA, so I can't claim that it's a clue that
the code is VBScript.

This line of code _is_ a dead giveaway for something else which indicates
it's VBScript, but I can't really expect Klatuu to know that, since Klatuu
has only been answering questions in the Access newsgroups for more than a
month.

Whenever one arrives at a new IT department, one can do a little research to
discover who the coders are -- and who will never be a coder. Likewise, one
can tell who the best coders are -- and which coders never will be the best.
The best coders write code that avoids bugs and makes bugs obvious, and code
clarity takes precedence over brevity. Such techniques develop into a
coding style that can be easily recognized, even when the author's name
doesn't accompany the code.

A VBScripter would have written:

Set oConn = CreateObject("ADODB.Connection")

.... because he knows he needs to connect to a database before doing the
database work.

A VB programmer or newer Access VBA programmer would have written:

Set objConnection = CreateObject("ADODB.Connection")
or
Set objConn = CreateObject("ADODB.Connection")

.... because he knows he needs a connection object instantiated before doing
the database work.

A more experienced Access VBA programmer would have written:

Set dbe = CreateObject("DAO.DBEngine.36")
or
Set engine = CreateObject("DAO.DBEngine.36")
or
Set DBEng = CreateObject("DAO.DBEngine.36")

.... because he knows he needs a database engine to do the database work.

But whenever one sees the following line of code:

Set oJet = CreateObject("DAO.DBEngine.36")

.... it's very clear that the original author knows he needs Jet to do the
database work, and that he has to instantiate the object before doing so.

This line of code is a dead giveaway that the code is VBScript written by
none other than John Nurick -- or else borrowed from one of your VBScript
examples (or Ronny Ong's single example a few years ago), because this is
your coding style. Other lines of code will help distinguish whether the
code was borrowed from one of your examples or Ronny Ong's example.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)
 
A

Alex White MCDBA MCSE

Hi,

I also have been answering questions for a short while, and also have got
some things wrong (and I have been told!), it is part of the reason I am
doing this, to learn. Don't take personally what others say about you, it is
the taking part that is important and yes if we are wrong someone is going
to point that out, you will find the most experienced people here get it
wrong sometimes (maybe not often). By the simple fact you are participating
in the newsgroups ignorance is probably not one of your traits. We are all
novices at some things by answering questions here does not put you in the
novices category for Access, keep at it, it is very rewarding helping
others.

--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk

Klatuu said:
I consider your comment rude. So I misunderstood the question. Am I the
only one out here who ever made a mistake. Okay, so I have ony been
answering questions for a month or so; however, I have been programming in
multiple languages and platforms for only 28 years and only the last 5 in
Access. I guess I'm just an ignorant novice.
 
G

Guest

Thanks for your kind response, Alex. I am not normally bothered by someone
pointing out a mistake. If no one ever did that, we would not learn much.
There are many things I don't know and a few that I do. I participate here
to learn as much as help. It was the tone with which the message was
delivered. Particularly the comment that Klatuu has only been posting for a
month. The implecation is that my comments are of little or no value. That
is why this particular post offended me.
 
6

'69 Camaro

Hi, Klatuu.
I guess I'm just an ignorant novice.

It's easy to get under your skin. I'll give you that much. But I think we
can all agree that you've proven that you aren't ignorant, and you aren't a
novice.
I consider your comment rude.

Consider this instead:

Would it be fair for me to expect someone who has only been posting in the
Access newsgroups for more than a month to instantly recognize the coding
style of one of our most experienced experts, and know that this particular
line of code was a dead giveaway that it was borrowed from this expert's
VBScript examples, not VBA, even though the original author's name wasn't
included in the code sample given by the OP?

Of course not. And I pointed this out. Read the _entire_ sentence, not
just the dependent clause, and you'll realize this, too.
So I misunderstood the question.

You're trying to be helpful, just like the rest of us. Too often, the
questioner has a vague idea of either the problem or the proper terminology
to describe the problem. This wasn't one of those times, which is why I
pointed out for your future reference some of the clues that indicate this
questioner is using the correct terminology. In many professions, people
don't let others in on clues for when to zig and when to zag in their
career. Be thankful you're in IT, which has got to be one of the most
generous knowledge-distribution fields in the world.
Am I the
only one out here who ever made a mistake.

Wait a minute, buddy. No cuts. You have to get to the end of the line
behind all of the rest of us and wait your turn to ask this same question of
the powers that be.
Okay, so I have ony been
answering questions for a month or so

And you didn't start a moment too soon, either. The questions are piling
up, but it would have been worse without your participation.
however, I have been programming in
multiple languages and platforms for only 28 years and only the last 5 in
Access.

I suppose you think this means you get the best parking space. Nope. You
have to beat Doug Steele for the most prolific poster to get that parking
space. Don't count on this happening in your lifetime.

It's Monday morning. Take a deep breath, go get a cup of coffee, and get
back to work. People need help with their Access databases, and some of
them happen to be looking to you for guidance. Don't keep them waiting.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)


Klatuu said:
I consider your comment rude. So I misunderstood the question. Am I the
only one out here who ever made a mistake. Okay, so I have ony been
answering questions for a month or so; however, I have been programming in
multiple languages and platforms for only 28 years and only the last 5 in
Access. I guess I'm just an ignorant novice.
 
6

'69 Camaro

Hi, Klatuu.
It was the tone with which the message was
delivered.

You're misinterpreting the tone, which, considering that only written words
are being communicated, can be understandable.
Particularly the comment that Klatuu has only been posting for a
month.

I was pointing out that you just got here and shouldn't be expected to know
things that others already know or can identify because they have the
benefit of having been around here for a lot longer than you have.
The implecation is that my comments are of little or no value.

The implication is that you're being cut some slack because you just got
here. And the implication is that you got plenty of exercise this morning
jumping to a conclusion.

HTH.

Gunny
 
6

'69 Camaro

Hi, John.

Like most Gunnys, I've got all the subtleties of an M-60 machine gun. ;-)

Gunny


John Nurick said:
Hi Gunny,

That's what I call subtle reasoning<g>.
 
G

Guest

I was not asking for any special consideration, not did I know that the
questioner is a seasoned expert. It is not particulary easy to get under my
skin. You can descern tone in the written word. I will just have to accept
the fact that your style is blunt and to the point and not be bothered by it.
I am not asking for any special parking spot and I really don't care who has
it. Even though you have explained your comment, you would have to agree,
that on the surface you comment about how long I have been posting appears
demeaning.

So, with that said, I'm over it. I see your posts out here a lot and you
usually have good advice to give. One of the things I use this site for is
to look at other posts, figure out my own resolution, and see how it matches
with others. You are one of the posters I know and respect enough to compare
against. Not to see if I did any better, but to see if I'm on the same page.
I get as much from this as I give, maybe more.

Have a great Monday.
 
Top