Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Code to insert records into a table


Message #1 by gbrown@c... on Sat, 21 Jul 2001 14:05:57
Hi all



Further to my previous question about record sizes in access, I've now 

written a fox program which creates loads of commands for inserting this 

data. So I have :-



Insert into vehicles (field1,field2....) values ('a','b'....);



These lines are long probably spanning 10 lines each.



I've put these into a webapp using ADO and ASP but would be interested to 

see how I can run these in access. If I understand properly I have to 

create a module and use the docmds method of the database object. 

Is that correct?



If anyone could let me have any sample code I'd be really grateful, that 

way I can write the VFP stuff to drop out the code in the correct syntax 

so I can just cut and paste.



Thanks 



Regards

Graham

Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 23 Jul 2001 07:31:03 -0700
I can think of two ways to write code to execute SQL INSERT statements--the

easiest is with the DoCmd object:



With DoCmd

 .SetWarnings False

 .RunSQL <<your string variable w/the SQL statement goes here>>

 .SetWarnings True

End With



If that doesn't appeal, you can use temporary QueryDef objects (in DAO), or

the .Execute method of a Connection object (in ADO).  See if the help file

is helpful--if not, post a follow-up question.



HTH,



-Roy



P.S. Gratuitous nosy question: I think you mentioned that you'd be upsizing

to SQL server pretty soon--why not just skip the Access step & go right to

SQL Server (or MSDE if you've not yet purchased SQL Server)?



-----Original Message-----

From: gbrown@c... [mailto:gbrown@c...]

Sent: Saturday, July 21, 2001 7:06 AM

To: Access

Subject: [access] Code to insert records into a table





Hi all



Further to my previous question about record sizes in access, I've now 

written a fox program which creates loads of commands for inserting this 

data. So I have :-



Insert into vehicles (field1,field2....) values ('a','b'....);



These lines are long probably spanning 10 lines each.



I've put these into a webapp using ADO and ASP but would be interested to 

see how I can run these in access. If I understand properly I have to 

create a module and use the docmds method of the database object. 

Is that correct?



If anyone could let me have any sample code I'd be really grateful, that 

way I can write the VFP stuff to drop out the code in the correct syntax 

so I can just cut and paste.



Thanks 



Regards

Graham

Message #3 by gbrown@c... on Mon, 23 Jul 2001 16:08:35
Hi Roy



Thanks for the reply!



Answer is that this is our first webapp, so I wanted to keep it fairly 

simple. Our ISP also provides access within the package but SQL server is 

an addition, although I have now bought this anyway.



I do take your point on the MSDE though as I am a Vis fox programmer by 

trade, I have come across this but have heard that it is fixed to 

problematic with over 6 users. I've put in a win nt server at home to test 

msde and sql server at some stage when it is quiet.



Regards



Graham







> I can think of two ways to write code to execute SQL INSERT statements--

the

> easiest is with the DoCmd object:

> 

> With DoCmd

>  .SetWarnings False

>  .RunSQL <<your string variable w/the SQL statement goes here>>

>  .SetWarnings True

> End With

> 

> If that doesn't appeal, you can use temporary QueryDef objects (in DAO), 

or

> the .Execute method of a Connection object (in ADO).  See if the help 

file

> is helpful--if not, post a follow-up question.

> 

> HTH,

> 

> -Roy

> 

> P.S. Gratuitous nosy question: I think you mentioned that you'd be 

upsizing

> to SQL server pretty soon--why not just skip the Access step & go right 

to

> SQL Server (or MSDE if you've not yet purchased SQL Server)?

> 

> -----Original Message-----

> From: gbrown@c... [mailto:gbrown@c...]

> Sent: Saturday, July 21, 2001 7:06 AM

> To: Access

> Subject: [access] Code to insert records into a table

> 

> 

> Hi all

> 

> Further to my previous question about record sizes in access, I've now 

> written a fox program which creates loads of commands for inserting this 

> data. So I have :-

> 

> Insert into vehicles (field1,field2....) values ('a','b'....);

> 

> These lines are long probably spanning 10 lines each.

> 

> I've put these into a webapp using ADO and ASP but would be interested 

to 

> see how I can run these in access. If I understand properly I have to 

> create a module and use the docmds method of the database object. 

> Is that correct?

> 

> If anyone could let me have any sample code I'd be really grateful, that 

> way I can write the VFP stuff to drop out the code in the correct syntax 

> so I can just cut and paste.

> 

> Thanks 

> 

> Regards

> Graham

Message #4 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 23 Jul 2001 08:41:00 -0700
Happy to be of service.  Those sound like good reasons for sticking

w/Access--thanks for indulging me.  I believe MSDE is hobbled such that it

will only tolerate 5 concurrent connections.



Cheers,



-Roy



-----Original Message-----

From: gbrown@c... [mailto:gbrown@c...]

Sent: Monday, July 23, 2001 9:08 AM

To: Access

Subject: [access] RE: Code to insert records into a table





Hi Roy



Thanks for the reply!



Answer is that this is our first webapp, so I wanted to keep it fairly 

simple. Our ISP also provides access within the package but SQL server is 

an addition, although I have now bought this anyway.



I do take your point on the MSDE though as I am a Vis fox programmer by 

trade, I have come across this but have heard that it is fixed to 

problematic with over 6 users. I've put in a win nt server at home to test 

msde and sql server at some stage when it is quiet.



Regards



Graham







> I can think of two ways to write code to execute SQL INSERT statements--

the

> easiest is with the DoCmd object:

> 

> With DoCmd

>  .SetWarnings False

>  .RunSQL <<your string variable w/the SQL statement goes here>>

>  .SetWarnings True

> End With

> 

> If that doesn't appeal, you can use temporary QueryDef objects (in DAO), 

or

> the .Execute method of a Connection object (in ADO).  See if the help 

file

> is helpful--if not, post a follow-up question.

> 

> HTH,

> 

> -Roy

> 

> P.S. Gratuitous nosy question: I think you mentioned that you'd be 

upsizing

> to SQL server pretty soon--why not just skip the Access step & go right 

to

> SQL Server (or MSDE if you've not yet purchased SQL Server)?

> 

> -----Original Message-----

> From: gbrown@c... [mailto:gbrown@c...]

> Sent: Saturday, July 21, 2001 7:06 AM

> To: Access

> Subject: [access] Code to insert records into a table

> 

> 

> Hi all

> 

> Further to my previous question about record sizes in access, I've now 

> written a fox program which creates loads of commands for inserting this 

> data. So I have :-

> 

> Insert into vehicles (field1,field2....) values ('a','b'....);

> 

> These lines are long probably spanning 10 lines each.

> 

> I've put these into a webapp using ADO and ASP but would be interested 

to 

> see how I can run these in access. If I understand properly I have to 

> create a module and use the docmds method of the database object. 

> Is that correct?

> 

> If anyone could let me have any sample code I'd be really grateful, that 

> way I can write the VFP stuff to drop out the code in the correct syntax 

> so I can just cut and paste.

> 

> Thanks 

> 

> Regards

> Graham


  Return to Index