September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

My Links

ข่าวไอที

Green Navigator

ตัวอย่าง code vba สำหรับ Database

จดไว้กันลืม

Private Sub Command0_Click()

Dim db As Database

Dim rs As DAO.Recordset

Dim i As Integer

Dim Answer As String

Answer = MsgBox(“ต้องการลบข้อมูลจริงหรือไม่”, vbYesNo, “ยืนยันการลบ”)

If Answer = vbYes Then

Set db = CurrentDb()

Set rs = db.OpenRecordset(“select * from student_error”, dbOpenDynaset)

If rs.RecordCount <> 0 Then

rs.MoveFirst

Do While Not rs.EOF

Screen.MousePointer = 11

db.Execute “delete * from dbo_tb_student_status where ayear=2553 and term=1 and pclass=’Í.2′ and idstudent=” & rs.Fields(2).Value & “;”, dbSeeChanges

i = i + 1

rs.MoveNext

Loop

End If

Screen.MousePointer = 0

Text4 = “Delete ” & i & ” records.”

End If

End Sub

  • Share/Bookmark

1 comment to ตัวอย่าง code vba สำหรับ Database

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>