Results 1 to 5 of 5

Thread: How do I make a record search in Access VB? Not VB6...

Threaded View

  1. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    If your Form is assigned to a Table, you can use Me.RecordSet.MoveNext etc.

    Or,
    You can connect (similar to VB6) like:
    VB Code:
    1. Dim sql As String
    2.     Dim rs As New ADODB.Recordset
    3.  
    4. On Error GoTo Err_Handler
    5.  
    6.  
    7.   sql = "SELECT * FROM PriceList WHERE PriceID = " & strSearchFor & ""
    8.   rsPriceList.Open sql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
    9.   Do [b]Until[/b] rsPriceList.EOF    'No need to test for EOF / BOF, as Do Until will perform the same thing
    10.     rsPriceList.Fields("Name").Value = NameTxt.Text
    11.     rsPriceList.MoveNext
    12.   Loop
    13.   rs.Close
    14.   Set rs = Nothing
    15.  
    16. 'Your Error Handler Here
    Last edited by Bruce Fox; Apr 8th, 2003 at 04:49 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width