How to create a Table from Query in VBA ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mr Key
    New Member
    • Aug 2010
    • 132

    How to create a Table from Query in VBA ?

    Hi all!
    Once again I have found myself in position of asking for your assistance!
    Your hints,Contribut ions or Creations has been very usefully for access users around the world!

    I have a query (ModQuery)selec ted from two tables as
    Code:
    SELECT Modules.ModuleID, Modules.ModName, Modules.NtaID, tbStudent.[First name],
    tbStudent.[Last Name] FROM (Department INNER JOIN tbStudent
    ON Department.[DeptID] = tbStudent.[DepartmentID]) INNER JOIN Modules ON 
    Department.[DeptID] = Modules.[DeptID];
    I would like the following to happen from this query:
    1. Create a table using VBA (tblModQuery)
    2. Insert a new Column in this new table
    2. This table should be updatable as we always expect new data from tables to update a query
    (ModQuery) and hence a new table (tblModQuery)
    Please help!
  • meabi
    New Member
    • Dec 2010
    • 4

    #2
    its the same syntaxt as in SQL server

    Comment

    • Mr Key
      New Member
      • Aug 2010
      • 132

      #3
      What do you mean?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32653

        #4
        Mr Key, if you need to add data to a table later, then creating it from scratch in your code doesn't make any sense does it. Append queries may be a solution, but before you start looking for solutions you need to makes sure you have a clear idea to start with of what you want (One that makes proper sense).

        PS. When you do decide what you want, please ensure you only have one question per thread.

        Comment

        • Mr Key
          New Member
          • Aug 2010
          • 132

          #5
          Thanks neopa for your sugesstion!
          Append query will be the only solution if it works without any errors or unfriendly warning messages. Sometimes you may try to append records but end-up with errors like, DATA MISMATCH, UNKOWN FIELD NAME and the like. Just imagine 10-staffmembers are using the database, how many times they will call for your assistance a day? The answer is: you wont do anything as, rather than clearing their error messages. It doesnt sound any good.
          The strange thing is, you may append once and goes fine, try to append again, this time it gives numerous warnings and errors.
          My request is:
          1. To be able to use the append query without a warning messages even if some FIELDS is null.
          2. Or to create a updateable table from query if possible.
          Please help!

          Comment

          • Mr Key
            New Member
            • Aug 2010
            • 132

            #6
            Well, thanks!
            Finally its answered!
            I found a hint from AllenBrown-Website That explains a bit about similar situations, and I could grab something from their that solve my problem.
            thanks all!!!
            Last edited by Mr Key; Dec 14 '10, 03:25 AM. Reason: Explain

            Comment

            Working...