Hello there,
I am trying without much success to display multiple columns from a database where the selected data is dependant on specific common data.
I have tried using an SQL statement with a Jet 4.0 OLE DB connection.

SELECT Name,Date,Action FROM Track WHERE SerialNumber="1"

with the output displayed in a datagrid.
OK, this gives me roughly what I need. However, what I require is the option to define the value for SerialNumber at runtime.
Any assistance at all would be greatly appreciated. Even if someone could point me towards the type of information I should go in search of.

Recommended Answers

All 3 Replies

SELECT Name,Date,Action FROM Track WHERE SerialNumber = " & val(text1.text)

"SELECT Name,Date,Action FROM Track WHERE SerialNumber='" & Trim(txtSerial.Text) &"'"

Thanks for the replies. I don't think I worded the question too well. The SQL wasn't the major problem , it was more to do with displaying the resulting recordset on my form.Using a data environment was OK until I introduced variables.
Anyway I finally got what I required using a Listview control.
http://www.vb6.us/ was a fantastic source of information and code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.