Find record with Criteria

D

DawnP277

I am looking to prompt the user for a block number and use the block number
as the criteria for which record is displayed on a form.

Does anyone have any suggestions.

Here is the code that i am playing with.

Thanks
Dawn
Private Sub Form_Load()


'The Code to Find a record in a recordset is as follow:

Dim Block
Dim rst As Recordset
Dim strCriteria As String


Set rst = CurrentDb.OpenRecordset("SheeterInfo", dbOpenDynaset)
Block = InputBox("Enter the Block you want to Edit", "Block_Number")
Block = CStr(UCase(Block))



rst.FindFirst "(BlockNumber = " &Block)

If rst.NoMatch Then
MsgBox "No such record"
End If
rst.Close
Set rst = Nothing


Me.Employee.SetFocus
 
D

Dorian

I would have your form bound to the table containing the column 'block
number', you would then use the 'ApplyFilter' command to filter just the
block number you want.
Look up 'ApplyFilter' in the Access help screens.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top