how to write table name?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mclueless
    New Member
    • Jan 2008
    • 56

    how to write table name?

    I am using VB6 and Access n ADODB. Now...i have 12 tables to storing Invoice details. each table is called INV and is suffixed with month number ie INV01, INV02, INV03 etc...

    Depending upon the Date of Invoice, the table to be used should be decided ie if the date is 08/02/2008 then that entry should be entered in the table INV02. How can this be done?
  • werks
    New Member
    • Dec 2007
    • 218

    #2
    Originally posted by mclueless
    I am using VB6 and Access n ADODB. Now...i have 12 tables to storing Invoice details. each table is called INV and is suffixed with month number ie INV01, INV02, INV03 etc...

    Depending upon the Date of Invoice, the table to be used should be decided ie if the date is 08/02/2008 then that entry should be entered in the table INV02. How can this be done?
    What is the format of your date? 08/02/2008 = Day/Month/Year

    --
    Kenneth
    "Better Than Yesterday"

    Comment

    • lotus18
      Contributor
      • Nov 2007
      • 865

      #3
      [code=vb]

      Dim r As Date
      Dim s As String

      r = #8/2/2008#
      s = "INV" & Month(Format(r, "dd/mm/yyyy"))

      [/code]

      Rey Sean

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        [CODE=vb]
        Dim d As Date, s As String
        d = "8-Feb-2008"
        s = "INV" & Format(Month(d) , "00")
        [/CODE]

        Comment

        • mclueless
          New Member
          • Jan 2008
          • 56

          #5
          Originally posted by Killer42
          [CODE=vb]
          Dim d As Date, s As String
          d = "8-Feb-2008"
          s = "INV" & Format(Month(d) , "00")
          [/CODE]



          so how do i write the sql query to insert that record in the concerned table???...

          Comment

          • jamesd0142
            Contributor
            • Sep 2007
            • 471

            #6
            Originally posted by mclueless
            so how do i write the sql query to insert that record in the concerned table???...
            from what i can see with killer42's code... s will store the name of the table you need to populate:

            so sql something like

            "update " & s & " set <..remaining statement>"
            Last edited by Killer42; Feb 14 '08, 10:51 PM. Reason: Just bolded "s".

            Comment

            Working...