Option Compare Database
Private Sub Command1_Click()
Dim SQL
Dim strInput As String
strInput = InputBox("이름 일부만...", "이름일부입력창")
SQL = "Select * From [nhic] Where [NM] Like '" & "*" & strInput & "*" & "'"
Me.lstResult.RowSource = ""
Me.lstResult.RowSource = SQL
DoCmd.Requery "lstResult"
End Sub
Private Sub Command4_Click()
Dim ds As Database
Dim rs As Recordset
Dim strItems As String
Dim intCurrentRow As Integer
Set ds = CurrentDb
For intCurrentRow = 0 To Me.lstResult.ListCount - 1
If Me.lstResult.Selected(intCurrentRow) Then
Set rs = ds.OpenRecordset("Select * From [test];")
rs.AddNew
rs("NM") = Me.lstResult.Column(0, intCurrentRow)
rs("JUMIN_NO") = Me.lstResult.Column(1, intCurrentRow)
rs("POST_NO") = Me.lstResult.Column(2, intCurrentRow)
rs("DAE_ADDR_2") = Me.lstResult.Column(3, intCurrentRow)
rs("TEL_NO") = Me.lstResult.Column(4, intCurrentRow)
rs("HAND_TEL_N") = Me.lstResult.Column(5, intCurrentRow)
rs.Update
rs.Close
End If
Next intCurrentRow
End Sub
Private Sub Command5_Click()
Dim ds As Database
Dim rs As Recordset
Dim strItems As String
Dim intCurrentRow As Integer
Set ds = CurrentDb
For intCurrentRow = 0 To Me.lstResult.ListCount - 1
If Me.lstResult.Selected(intCurrentRow) Then
Set rs = ds.OpenRecordset("Select Count([NM]) As tmpCnt From [test] Where [NM] = '" & Me.lstResult.Column(0, intCurrentRow) & "';")
If rs("tmpCnt") = 0 Then
Else
Set rs = ds.OpenRecordset("Select * From [test] Where [NM] = '" & Me.lstResult.Column(0, intCurrentRow) & "';")
rs.Delete
rs.Close
End If
End If
Next intCurrentRow
End Sub
'컴퓨터관련' 카테고리의 다른 글
MsgBox....펌 (0) | 2010.11.17 |
---|---|
rs.Move(), rs.MoveNext, rs.MovePrevious, rs.First, rs.Last....펌 (0) | 2010.11.15 |
sql hash join...펌 (0) | 2010.11.11 |
select case 표현식...펌 (0) | 2010.11.10 |
DoCmd.OutputTo dbf -> DoCmd.TransferDatabase...펌 (0) | 2010.11.09 |