Results 1 to 14 of 14
  1. #1
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39

    copy data from table1 to table2

    Hi..

    I want copy data from table1 data to table2 with using command button

    In table1
    Fields name Datatype
    customername text
    Add1 text
    Add2 text
    qty1 text
    qty2 text


    In table2
    from table1 copy to table2
    fields Name datatype
    customer name text
    Add1 text
    Add2 text
    qty1 number
    qty2 number

    In my table1 datatype is everthing in text but in my table2 some datatype is in text and number


    I really need help on this


    Thanks
    Mathanraj

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Are you wanting to just change the data type to number?

    Dale

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    As Dale has suggested, we really need to know your ultimate purpose, here. Copying the entire content from one Table to another violates the rules of Relational Databases. If you object is, indeed, simply to change the Datatypes of qty1 and qty2 from Text to Numbers you can do that in Table Design View; you'll receive a warning message that you may lose some data, but assuming that the data looks like 'numbers,' i.e. is all digits, that won't occur.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    My thoughts exactly Linq.

    Dale

  5. #5
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    BTW, In Bank table change the PK from text to AutoNumber.
    I just added another row (tblBank_ID) for this and made that row PK.

    Dale

  6. #6
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39
    In table1 i have data's and all in the dataype is in text
    and now i want to copy the entire data's
    from table1 to table2 but the qty1 change from text to number in datatype in table2.
    When I press command button it must copy the entire data's from table1 to table2

    I have attached sample database

    Thanks
    Mathanraj
    Attached Files Attached Files

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why do you want to copy data? If your true goal is just to change all the 'Q' fields to number type, simply open the table in design view and change the data type.
    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.

  8. #8
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39
    The user will run this program.
    So i don't want the user to modify the table ..
    That's why i going put the command button to copy the data from table 1 to table2 . with changing the data type for only in 'Q' fields.
    If the 'Q' is in text data type then if use search command for the fields 'Q' can't be process..
    Only if 'Q' is in number data type it can be search..

    Thanks
    Mathanraj

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by mathanraj76 View Post

    ...Only if 'Q' is in number data type it can be search...
    Where did you find that bit of misinformation? You can search on Fields of any Datatype, you simply have to use the proper syntax, which differs according to Datatype!

    What code are you currently using to perform your search?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  10. #10
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39
    I have attached the source code for search command..which i use ..


    Thanks
    Mathanraj
    Attached Files Attached Files

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I thought this search issue was already addressed and solved in other thread https://www.accessforums.net/program...tml#post174708

    Ling, OP has numeric data stored in text fields and filter criteria will not work correctly until the fields are changed to number type.
    Last edited by June7; 06-03-2013 at 12:53 AM.
    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.

  12. #12
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39
    Hi..June7

    But i have problem on my table to change the data type from text to number
    But I know it can be used it sql as "ALTER TABLE WITH MY TABLE NAME(MY FIELDS NAME AND DATATYPE) it can be change but i want to know how to do in vba..
    the rest of it was done and solved

    Thanks

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why do you need to use VBA and SQL to change datatype? Open the table in design view and change the data type. Done. Simple. No code.

    Then the search code I provided in other thread should work just fine.
    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.

  14. #14
    mathanraj76 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    39
    OK..I follow your Instructions..
    It should be more easy way to change the datatype..
    Thanks
    Mathanraj

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

Similar Threads

  1. TABLE1 VS TABLE2...Are all ID's from Table1 in Table2???
    By smoothlarryhughes in forum Queries
    Replies: 11
    Last Post: 10-26-2012, 11:28 AM
  2. How to copy Table2 columns in to Table1 ?
    By b.saimsc in forum Access
    Replies: 16
    Last Post: 10-13-2012, 06:07 AM
  3. Replies: 8
    Last Post: 07-08-2012, 02:20 PM
  4. Copy values from table1 to table2
    By wubbit in forum Queries
    Replies: 2
    Last Post: 04-19-2012, 04:40 PM
  5. Replies: 4
    Last Post: 08-04-2011, 02:57 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