Populating Text Field

A

ajbarilla

I am having problems trying to populate textboxes in a form from a
table. I have a form with textboxes labeled Text1, Text2, Text3....
I get an error on the "Me.[TextNo] = ![FieldName]" line
I have verified the TextNo and FieldName variables contain the correct
data so I assume its a syntax error.
Any help would be apprciated.


For I = 1 To 50
Set rst = db.OpenRecordset("SELECT * FROM tblFieldKey WHERE
tblFieldKey.ID = " & I)
With rst
FieldName = !field
End With

Set rstedit2 = db.OpenRecordset("SELECT * FROM " & "qryDealerdata
WHERE [PDN] = " & searchcrit)
With rstedit2
TextNo = "Text" & I
Me.[TextNo] = ![FieldName]
End With
Next I
 
K

Ken Sheridan

Try:

Me(TextNo)

When you use Me.[TextNo] it expects a control named "TextNo" not a variable
whose value is that string expression.

Ken Sheridan
Stafford, England
 

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

Similar Threads

Case and Recordsets 2
Next month 4
Open Recordset in Loop 5
3163 Field is too small 2
selsct a field 0
Currenct issue with a text box 1
Dynamic Naming of Form Button 3
selsct a field of table 0

Top