Kamis, 08 Agustus 2013

[MS_AccessPros] Displaying records using code

 

I have an bound search-form which uses the following code to load records when criteria's matched. This code can only display a single record. However, when searching by ZipCode, or City, or State, the recordset normally contains more than 1 record. How do I modyfy this code so when the navigation button's clicked the records will move to the next record another…?

strSQL = "SELECT * FROM tblTEST"
strSQL = strSQL & " Where " & strWhere ";"
Debug.Print strSQL
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rs.RecordCount = 0 Then
rs.MoveFirst
rs.MoveLast
Me.lblRecCount.Caption = rs.RecordCount & " records found."
With Me
.txtAcctNum = rs!AcctNum
.txtName = rs!sName
.txtCity = rs!City
.txtState = rs!State
.txtZipCode = rs!ZipCode
End With

Thanks a lot.

Phucon

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar