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

From recordset to text box - should be easy but i cant get it to work

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
hey me again. trying to get data from a recordset and whack it all into text boxes... this using a value entered into a text box. Im not sure what the [start] was in the prodrec.move (this_bits_ok, [start]) part of the code so i left it out. is this the reason? what does the start do? I assume it states where in the record to start reading from?

ProdRec.Open "SELECT * FROM Product WHERE ([Ean 8/13] = '" & Criteria & "')", Cnct, adOpenKeyset, adLockReadOnly

If Not (ProdRec.BOF And ProdRec.EOF) Then
ProdRec.Move (Val(Criteria))
While Not ProdRec.EOF
form1.txtEAN.Text = ProdRec.Fields("Ean 8/13").Value
form1.txtTitle.Text = ProdRec.Fields("Title").Value
form1.txtTitle.Refresh
form1.txtPrice.Text = ProdRec.Fields("Price").Value
ProdRec.MoveNext
Wend
End If

TIA

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
form1.txtEAN.Text = ProdRec.Fields("Title")

Take away the .Value

if your in the form "form1" you dont have to type form1.txtEn.Text = etc...

txtEN.Text = ProdRec.Fields("Title") & ""



 
that doesnt work tried it before and ive just tried it now, not working

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
Your recordset is selected with a WHERE clause, therefore you don't need the < ProdRec.Move (Val(Criteria)) >
You probably don't need < form1.txtTitle.Refresh >
either.

If your recordset contains more than 1 value, you'll only see the last one, as previous values will be overwritten on each loop.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
>< this is stupid thanks for the help, im gonna give you a star johnwm. im sure its the right solution however my code is messed up (i wrote it after all). im gonna go experiment with keys now wish me luck.

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top