Kamis, 08 Agustus 2013

RE: [MS_AccessPros] Displaying records using code

Phucon,

Why are you not using a bound form to display the results? It would be much much easier and accepted.

Duane Hookom MVP
MS Access

----------------------------------------
> From: saigonf7q5@yahoo.com
>
> 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

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar