textbox value in datasheet change value in loop.

S

Steven Scaife

Is it possible to change the value of a text box in a loop when it is a
datasheet.

I have some code that clones the forms recordset and loops through talking
part of a value in the table what i want to do is then write it to the text
box but it doesn't write it to the text box how i imagined. I know the code
for the loop is working cos i seen it in the debug window. However it
writes the last number from the recordset in every row. any ideas. thanks
in advance

Dim strDate As String
Dim RSt As Recordset
Dim RstCount As Integer
Dim i As Integer

Set RSt = Me.RecordsetClone

RSt.MoveFirst
RstCount = RSt.RecordCount

For i = 1 To RstCount

strDate = RSt("Contract ID")
strDate = Right(strDate, 4)

Debug.Print strDate
Me.txtOoD.Value = strDate

RSt.MoveNext
i = i + 1
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top