Re: Help with found code

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Okay, I see.

I only see three value fields in your SQL statement:

INSERT INTO T_CurrentUsers(COMPUTER_NAME, LOGIN_NAME, CONNECTED,
SUSPECT_STATE) VALUES ('WSUSJXC2B2A169A ', 'admin
', 'True ', )

The only thing I can think of is that there are special characters in the
apparent spaces between the PC Name and the closing quote.

Let's step back a minute, though. Why do you want to store this information
in a table?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Stephen sjw_ost" <Stephensjwost@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:241290CB-6771-4555-8E90-24E7B3365382@xxxxxxxxxxxxxxxx
WSUSJXC2B2A169A is the PC NAME. I mearly called it PC NAME when descrbing
the
error. PC NAME is not part of the code, it is only a description of
WSUSJXC2B2A169A that I used to present the error that was occuring. Sorry
for
the confusion.

"Douglas J. Steele" wrote:

While WSUSJXC2B2A169A is a PC NAME, I cannot see how your error message
would mention PC NAME in it since your code doesn't call anything PC
NAME!

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Stephen sjw_ost" <Stephensjwost@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:3C4CBF2A-970E-41C5-BC7B-93FD44C9C639@xxxxxxxxxxxxxxxx
Immediate Window shows;

INSERT INTO T_CurrentUsers(COMPUTER_NAME, LOGIN_NAME, CONNECTED,
SUSPECT_STATE) VALUES ('WSUSJXC2B2A169A ', 'admin
', 'True ', )

When it fails. the WSUSJXC2B2A169A is PC NAME.
I have a table T_CurrentUsers in both the IDAUSER.mdb and AGETNID.mdb.

"Douglas J. Steele" wrote:

I don't see PC NAME anywhere in your code!

Inside the loop, try:

While Not rs.EOF

strSQL = "INSERT INTO T_CurrentUsers" & _
"(COMPUTER_NAME, LOGIN_NAME, CONNECTED, SUSPECT_STATE) " & _
"VALUES ('" & rs.Fields(0) & "', '" & rs.Fields(1) & "', '" & _
rs.Fields(2) & " ', " & rs.Fields(3) & ")"

Debug.Print strSQL

cm.CommandText = strSQL
cm.Execute
rs.MoveNext
Wend

Now, when the code fails, go to the Immediate Window (Ctrl-G) and see
the
SQL string printed there.

Note that I've got a space after the closing parenthesis on the second
line
of the SQL statement.






.



Relevant Pages

  • Re: Call Module from SQL
    ... Doug Steele, Microsoft Access MVP ... a SQL statement and it keeps prompting me for one of the module ... Public Function SplitItDbl(ByVal lngNdx As Long, ... I am using the DoCmd.RunSQL to run the SQL statement. ...
    (microsoft.public.access.modulesdaovba)
  • Re: how to use AVERAGE function across
    ... While your query is open in Design view, change the view to SQL View. ... Copy the SQL statement that was generated into your reply. ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • Re: Date type Variable - Type Mismatch
    ... Doug Steele, Microsoft Access MVP ... variables will be included into a SQL statement to populate my SQL back ... Dim dteInterimDteOrder As Date ...
    (microsoft.public.access.formscoding)
  • Re: Help with found code
    ... Doug Steele, Microsoft Access MVP ... "Douglas J. Steele" wrote: ... I only see three value fields in your SQL statement: ...
    (microsoft.public.access.modulesdaovba)
  • Re: How the heck can I achieve what I want in my query?
    ... Here's my SQL statement for the query in question: ... Doug Steele, Microsoft Access MVP ... (no private e-mails, please) ...
    (microsoft.public.access.queries)