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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Records On a Form

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
0
0
NZ
Could somebody please help me.

I have an Access table with the following fields ID(Primary Key), Island, PlantNumber, RegNumber, Plant Description, AccNumber, AccDescription Tracked. I have created a connection to the table using ADO (Data Environment – deWorks, Connection – cnWorks, Command – cmWorks).

On the form I have a command button, a text box and the data grid control. When I enter the PlantNumber or RegNumber into the text box and press the command button I would like the records that meet the text box criteria to be displayed in the data grid.

Could somebody please give me an idea as the correct syntax that I could use for this
 
ur better off using an ADO Data Control 6.0 from the components menu (ctrl T) and using that as a DataSource for the data grid.

use the following after u have bound the ADO Control to the data grid.

Private Sub Command1_Click()

sql = "SELECT * FROM tb1 WHERE PartNo = '" & text1 & "'"
adodc1.RecordSource = sql
adodc1.refresh

End Sub

personally id avoid using a data environment as ur better off keeping it all on the form


 
just set the datagrids record source to your recordset.
how are you connected..ADO? or are you using the ADODC?
 
I will take the advice of makeShift and use ADODC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top