Results 1 to 6 of 6
  1. #1
    venkatesh.g is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    3

    copying table during runtime in java

    Hi,

    Kindly let me know how to copy a table(both structure and data) during runtime using java programming.

    Looking for equivalent access commands for the following sql commands.

    1. create table newemp select * from emp;
    2. alter table newemp add userAns int;
    3. update newemp set userAns=0;
    4. drop table newemp;



    Regards,
    Venkatesh G

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    One version of code to run SQL statement in VBA:

    CurrentDb.Execute "CREATE TABLE newemp SELECT * FROM emp"
    CurrentDb.Execute "ALTER TABLE newemp ADD userAns int"
    CurrentDb.Execute "UPDATE newemp SET userAns=0"
    CurrentDb.Execute "DROP TABLE newemp"

    Look at http://www.functionx.com/vbaccess2003/Lesson08c.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    venkatesh.g is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    3
    Hi June7,

    Thanks for the reply.

    The code you have mentioned is VBA code. But I want to execute those queries in Java.

    Regards,
    gv

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Then this is not an Access question, it is a Java issue. You might try a Java forum. Look at http://www.developerbarn.com/forums/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    venkatesh.g is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    3
    Hi,

    I guess this is not java query.

    I'm looking for MSAccess equivalent of SQL commands I have mentioned. Simply MS Access query not VBA code.

    Regards,
    gv

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    SQL statement is basically the same. Use the Access query designer to help you build some queries. Then you can view the SQL statement in the SQL View window of the designer. Or go straight to the SQL View and type query statement. Access Help has guidelines on using the designer. The ALTER and DROP probably can be done only in VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-08-2011, 02:58 AM
  2. Replies: 3
    Last Post: 05-15-2011, 10:52 PM
  3. Need help in VBA programming (java translation)
    By toqilula in forum Programming
    Replies: 1
    Last Post: 04-21-2011, 02:37 AM
  4. Replies: 5
    Last Post: 03-23-2011, 10:39 AM
  5. Replies: 6
    Last Post: 03-22-2011, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums