F
FKlusmann
Hello and thanks again.
I'd like to get several lines of text from a table and display them in forms
textboxes.
My table is TextTest01 with 3 fields (no PK, no index):
sel is text field size: 2
lineNo is number long integer
line is text field size 80
My unbound form fTestText01 has 10 textboxes named Line01, Line02 .. To
Line10.
My code efforts are:
Private Sub Form_Open(Cancel As Integer)
Dim linecount As Integer ' Line conter (set to 9 for this test)
Dim ctr As Integer ' Counter to be incremented
Dim varResult As Variant ' will hold the answer Dlookup provides
Dim txtboxname As Variant ' the name of form's textbox to be populated
Dim selct As String ' A group indicator will come from a table
selct = "W" ' W indicates Welcome
linecount = 9 ' maximum number of lines to display
For ctr = 1 To linecount
' the answer the text the table tbl field match value
varResult = DLookup("[line]", "TextTest01", "[sel] = '" & [selct] & "'")
' this finds the correct text.
' where I want this to be displayed
txtboxname = ("Line0" & CStr(ctr)) ' dim'd as object gives error 91
' this holds the correct form textbox names
' Me.Controls("txtboxname").Text
' txtboxname dim'd as string gave error 2465 Tab Tests -(Keep) can't find
the field "txtboxname ..
Set txtboxname = varResult
' when dim'd as string gives error 424 - object required
' when dim'd as object gives
' when dim'd as variant gives run-time error 13 type mismatch
Next ctr
End Sub
....
I would sure like your help to make this work.
Thanks, -- Fred
I'd like to get several lines of text from a table and display them in forms
textboxes.
My table is TextTest01 with 3 fields (no PK, no index):
sel is text field size: 2
lineNo is number long integer
line is text field size 80
My unbound form fTestText01 has 10 textboxes named Line01, Line02 .. To
Line10.
My code efforts are:
Private Sub Form_Open(Cancel As Integer)
Dim linecount As Integer ' Line conter (set to 9 for this test)
Dim ctr As Integer ' Counter to be incremented
Dim varResult As Variant ' will hold the answer Dlookup provides
Dim txtboxname As Variant ' the name of form's textbox to be populated
Dim selct As String ' A group indicator will come from a table
selct = "W" ' W indicates Welcome
linecount = 9 ' maximum number of lines to display
For ctr = 1 To linecount
' the answer the text the table tbl field match value
varResult = DLookup("[line]", "TextTest01", "[sel] = '" & [selct] & "'")
' this finds the correct text.
' where I want this to be displayed
txtboxname = ("Line0" & CStr(ctr)) ' dim'd as object gives error 91
' this holds the correct form textbox names
' Me.Controls("txtboxname").Text
' txtboxname dim'd as string gave error 2465 Tab Tests -(Keep) can't find
the field "txtboxname ..
Set txtboxname = varResult
' when dim'd as string gives error 424 - object required
' when dim'd as object gives
' when dim'd as variant gives run-time error 13 type mismatch
Next ctr
End Sub
....
I would sure like your help to make this work.
Thanks, -- Fred