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

Search Button

Status
Not open for further replies.

JackBurton07

IS-IT--Management
Oct 17, 2007
75
GB
Hi I cant get my search button to work - can you see anything wrong below?

many thanks

jb



Private Sub btnfmssearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfmssearch.Click


myRecordSet.Open("Select* from market where fmsidno=" & fmsidno.Text, myDb)
If Not myRecordSet.EOF Then ' if it's not the EOF (records are returned) set values

mktp1.Text = myRecordSet.Fields("market1").Value
mktp2.Text = myRecordSet.Fields("market2").Value
mktp3.Text = myRecordSet.Fields("market3").Value()

mktp4.Text = myRecordSet.Fields("market4").Value()
mktp5.Text = myRecordSet.Fields("market5").Value
mktp6.Text = myRecordSet.Fields("market6").Value
mktp7.Text = myRecordSet.Fields("market7").Value
mktp8.Text = myRecordSet.Fields("market8").Value
bs1.Text = myRecordSet.Fields("bs1").Value
bs2.Text = myRecordSet.Fields("bs2").Value
bs3.Text = myRecordSet.Fields("bs3").Value
bs4.Text = myRecordSet.Fields("bs4").Value
bs5.Text = myRecordSet.Fields("bs5").Value
bs6.Text = myRecordSet.Fields("bs6").Value
bs7.Text = myRecordSet.Fields("bs7").Value
bs8.Text = myRecordSet.Fields("bs8").Value

txtstrike1.Text = myRecordSet.Fields("strike1").Value
txtstrike2.Text = myRecordSet.Fields("strike2").Value
txtstrike3.Text = myRecordSet.Fields("strike3").Value

txtstrike4.Text = myRecordSet.Fields("strike4").Value
txtstrike5.Text = myRecordSet.Fields("strike5").Value
txtstrike6.Text = myRecordSet.Fields("strike6").Value
txtstrike7.Text = myRecordSet.Fields("strike7").Value
txtstrike8.Text = myRecordSet.Fields("strike8").Value








myRecordSet.Close() ' close rs when values added to form

'ENABLE the edit and delete buttons if records found (i assume you don't want them enabled if there's no data?)
Me.cmdEdit.Enabled = True
Me.cmdDelete.Enabled = True

Else ' no records returned
MsgBox("No data available for specified date - contact London Lehman Market Data Team on +44 2020 551-3366 to report this")
btnfmssearch.Enabled = False
fmsclearfields() 'function clears all fields'
myRecordSet.Close() 'close rs
End If





End Sub
 
The only obvious thing is that there is no space between SELECT and the asterisk so the command would be invalid.

However what is the object type of myRecordSet? This looks like an old ADO (as opposed to ADO.NET) object. Why are you using this deprecated db access method?



Bob Boffin
 
You might need single quotes around your criteria if you are searching on a character data type.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top