Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I refresh data on a form using values from a textbox ?

Status
Not open for further replies.

DaJoin

Technical User
Sep 15, 2002
9
BE
All,

This is what I wanna do : (newbie question ....)

I made a form, based on a query.
In that form, I have a header part containing a text box, and a detail part containing record information from a query.
In this query, the text box from the header is part of the where clause. Problem is that I do not know how to 'refresh' the data in the grid depending on the value of the text box .
Thanks in advance for your aswers .
 
I use this only with one text box and a datagrid to select member names using the first 3 characters of the last name
All members having those characters are displayed in the grid and the operator will select one using the up or down arrows and pressing enter. Hope this helps and is not clear off the mark.

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
'Search in this case is first 3 characters of last name in a query.
Data1.RecordSource = "SELECT Number, Name FROM qrySearchFile WHERE Search = '" & _
Text1 & "' ORDER BY Name"

Data1.Refresh
DBGrid7.Visible = True 'dbgrid 7 is bound to Data1 - DAO
Frame1.Visible = True
DBGrid7.SetFocus
Text1 = ""
End If
' this is the grid

Private Sub DBGrid7_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then
With Data1.Recordset
CurrentRecord = !Number ' !Number is taken from the grid when the name is selected
End With
DBGrid7.Visible = False 'hiding the grid after selection is made
Frame1.Visible = False 'frame1 contains instructions on how to search the grid
ShowCurrent 'this is a sub procedure that selects a dataset
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top