docmd.runsql repeat problem 
Author Message
 docmd.runsql repeat problem

    Hi all, I have an unbound form from which I use a runsql append query to
input the data to the table. Then it clears the unbound form of information
for the proccess to be repeated. My problem is that I keep getting
violations when the runsql executes so it only inserts the first record then
I have to close the form reopen it and I can insert the next record.

       Any one any ideas of what is happening. AS I am compeletely lost.

                    Thanks in advance Russ



Sun, 15 Aug 2004 08:58:07 GMT  
 docmd.runsql repeat problem
I found the answer but it's a wierd one that will course you the same
problem.

        The answer is this:

                  Even though you have an unbound form there must be sum
tags generated by the current form when you type in data that get transfered
when pass data through the RUNSQL.  What I did was to con the for by using
the docmd.gotorecord ,, acNewrec.   This cleared the form of the hidden bits
and allowed me to continue.

                   Hope this helps any one tring to do the same as me.

        Cheers Russ


Quote:

>     Hi all, I have an unbound form from which I use a runsql append query
to
> input the data to the table. Then it clears the unbound form of
information
> for the proccess to be repeated. My problem is that I keep getting
> violations when the runsql executes so it only inserts the first record
then
> I have to close the form reopen it and I can insert the next record.

>        Any one any ideas of what is happening. AS I am compeletely lost.

>                     Thanks in advance Russ



Sun, 15 Aug 2004 20:14:17 GMT  
 docmd.runsql repeat problem
Are you initializing the SQL statement after you run it?  Or before you
build it?

If not, the SQL statement may be retaining parts of your first
execution.    It is hard to diagnose this problem without seeing the
code.

Quote:

>     Hi all, I have an unbound form from which I use a runsql append query to
> input the data to the table. Then it clears the unbound form of information
> for the proccess to be repeated. My problem is that I keep getting
> violations when the runsql executes so it only inserts the first record then
> I have to close the form reopen it and I can insert the next record.

>        Any one any ideas of what is happening. AS I am compeletely lost.

>                     Thanks in advance Russ



Sun, 15 Aug 2004 21:17:25 GMT  
 docmd.runsql repeat problem
Hi John thanks for the reply,

        Basically I have one line of code :

          Docmd.runsql (insert into """"""""""  Lots of fields """""" vaues
"""""" Lots of values")

    and thats it for the running of the sql statement to append the data to
the the table.

So what you've sounds spot on .. question is how am I supposed to do it in
steps. IE initializing  the SQL then run it

           Thanks for your help

                       Russ



Quote:
> Are you initializing the SQL statement after you run it?  Or before you
> build it?

> If not, the SQL statement may be retaining parts of your first
> execution.    It is hard to diagnose this problem without seeing the
> code.


> >     Hi all, I have an unbound form from which I use a runsql append
query to
> > input the data to the table. Then it clears the unbound form of
information
> > for the proccess to be repeated. My problem is that I keep getting
> > violations when the runsql executes so it only inserts the first record
then
> > I have to close the form reopen it and I can insert the next record.

> >        Any one any ideas of what is happening. AS I am compeletely lost.

> >                     Thanks in advance Russ



Fri, 20 Aug 2004 17:51:11 GMT  
 docmd.runsql repeat problem
Again, without seeing the actual code you run it is difficult to guess.

You might try something like:

Private Sub WhatEverEventYouAreUsing()
Dim strSQL as String

  strSQL = ""
  strSQL = "Insert into Tablename (fieldlist) Values(valuelist)""

  DoCmd.RunSQL(strSQL)

End Sub

Quote:

> Hi John thanks for the reply,

>         Basically I have one line of code :

>           Docmd.runsql (insert into """"""""""  Lots of fields """""" vaues
> """""" Lots of values")

>     and thats it for the running of the sql statement to append the data to
> the the table.

> So what you've sounds spot on .. question is how am I supposed to do it in
> steps. IE initializing  the SQL then run it

>            Thanks for your help

>                        Russ



> > Are you initializing the SQL statement after you run it?  Or before you
> > build it?

> > If not, the SQL statement may be retaining parts of your first
> > execution.    It is hard to diagnose this problem without seeing the
> > code.


> > >     Hi all, I have an unbound form from which I use a runsql append
> query to
> > > input the data to the table. Then it clears the unbound form of
> information
> > > for the proccess to be repeated. My problem is that I keep getting
> > > violations when the runsql executes so it only inserts the first record
> then
> > > I have to close the form reopen it and I can insert the next record.

> > >        Any one any ideas of what is happening. AS I am compeletely lost.

> > >                     Thanks in advance Russ



Fri, 20 Aug 2004 20:31:40 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. docmd.RunSql problem

2. DoCmd.RunSQL

3. DoCmd.RunSQL Error

4. DoCmd.RunSQL error 2

5. docmd.RunSQL String Concatenation

6. DoCmd.RunSQL too long record

7. DoCmd.RunSQL

8. suppress warnings on DoCmd.RunSQL ?

9. docmd.runsql help required

10. DoCmd.RunSQL vs. Recordsets

11. docmd.runSQL fails on Windows 2000

12. Quick syntax question on - DoCmd.RunSQL

 

 
Powered by phpBB® Forum Software