Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Posts
    31

    Unanswered: Is is possible to write Script in Access ?

    Suppose I want to insert 10 records in an Access table. Is it possible to write script for that? I know it is possible to write a query for that. But do I need to write 10 queries for 10 records?

  2. #2
    Join Date
    Dec 2001
    Posts
    79
    "Scripting" in Access is accomplished with macros, or VBA code.

    You may be able to write code that loops 10 times to insert your 10 records.

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

  3. #3
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    You can use that

    Code:
    CurrentDb.Execute "QryAdd"
    To run a Query, it is the good way to do it because Access Security will prevent anyone that don't have the right to insert datas to run the query.

    You can also do
    Code:
    CurrentDb.Execute "INSERT INTO Table1 VALUES(111,'aaa')"
    But since it is not a Microsoft Access object, security right will do nothing to prevent someone to insert these datas

    JefB - hope it helps

  4. #4
    Join Date
    Feb 2002
    Posts
    31
    I figured out following way.

    Store the SQL statements in a file or table.

    Write a function using DoCmd.RunSQL or CurrentDb.Execute which will execute all the SQL strings found in the file/table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •