Can you Translate this to SQL????

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OldSchool
    New Member
    • Nov 2006
    • 27

    Can you Translate this to SQL????

    everyone can you traslate this to SQL... instead of ADDnew use INSERT
    Private Sub Command1_Click( )

    With Adodc1.Recordse t
    .AddNew
    !fldIDNUM = Text1
    !fldDATE = tim3
    !fldTIME = Time
    !Name = Text2
    !Position = Text3
    !ShiftCode = Text4
    !Line = Text5
    !UpdatingOffice r = Text6
    .Update
    .Requery



    End With
    Adodc1.Refresh

    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text1.SetFocus




    End Sub

    Private Sub Form_Load()
    Adodc1.Connecti onString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\Docum ents and Settings\Maan\D esktop\AMKOR Turnstyle\db1.m db;Persist Security Info=False"
    Adodc1.RecordSo urce = "SELECT * FROM Table1"
    Adodc1.Refresh




    End Sub>
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Originally posted by OldSchool
    everyone can you traslate this to SQL... instead of ADDnew use INSERT
    Private Sub Command1_Click( )

    With Adodc1.Recordse t
    .AddNew
    !fldIDNUM = Text1
    !fldDATE = tim3
    !fldTIME = Time
    !Name = Text2
    !Position = Text3
    !ShiftCode = Text4
    !Line = Text5
    !UpdatingOffice r = Text6
    .Update
    .Requery



    End With
    Adodc1.Refresh

    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text1.SetFocus




    End Sub

    Private Sub Form_Load()
    Adodc1.Connecti onString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\Docum ents and Settings\Maan\D esktop\AMKOR Turnstyle\db1.m db;Persist Security Info=False"
    Adodc1.RecordSo urce = "SELECT * FROM Table1"
    Adodc1.Refresh




    End Sub>

    Hi there,

    Kindly refer to below syntax, hope you can complete the rest. Good luck & Take care.

    Code:
      INSERT INTO table_name(field1,field2,field3,field4) values ('value1','value2','value3','value4')

    Comment

    • OldSchool
      New Member
      • Nov 2006
      • 27

      #3
      Originally posted by sashi
      Hi there,

      Kindly refer to below syntax, hope you can complete the rest. Good luck & Take care.

      Code:
        INSERT INTO table_name(field1,field2,field3,field4) values ('value1','value2','value3','value4')
      thanks!...
      but ill tried that before...
      want the value1 to value4 will vary, can i do this.

      INSERT INTO table_name(fiel d1,field2,field 3,field4) values ('value1.text', 'value2.text',' value3.text','v alue4.text')

      thank you!
      julius

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Originally posted by OldSchool
        thanks!...
        but ill tried that before...
        want the value1 to value4 will vary, can i do this.

        INSERT INTO table_name(fiel d1,field2,field 3,field4) values ('value1.text', 'value2.text',' value3.text','v alue4.text')

        thank you!
        julius
        Hi there,

        Kindly refer to below modified SQL statement, hope it helps. Good luck & Take care.

        Code:
        INSERT INTO table_name(field1,field2,field3,field4) values ('" & "Value1.Text" & "','" & "Value2.Text" & "','" & "Value3.Text" & "','" & "Value4.Text" & "')

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32633

          #5
          From the information available you need something like :
          Code:
          INSERT INTO DestTable
            (fldIDNUM,
             fldDATE,
             fldTIME,
             [Name],
             Position,
             ShiftCode,
             [Line],
             UpdatingOfficer)
          SELECT
             Text1,
             tim3,
             [Time],
             Text2,
             Text3,
             Text4,
             Text5,
             Text6
          FROM Table1

          Comment

          Working...