Dynamically create textboxes by an SQL result.

  • Thread starter Thread starter craigwharding
  • Start date Start date
C

craigwharding

Using MS Acces, I want to create query in Microsoft VB that produces
more than one row of results and I was to print each field of the
record into it's own text box or label. I have programmed before but
I'm not sure on the constructs to create a TextBox and also how to get
the records from the SQL statement using Micorosoft Visual Basic.

I want to make a select query using Microsoft VB and then take those
rows and print out the fields in their own textbox or label using only
Microsoft VB.

Does anyone know how I can approach this?

I have tried doing a simple:
Dim txtBox As TextBox

and trying to modify the text in that using txtBox.Text = "test", but I
get a Runtime Error of 91

Any help much appreciated.
 
You can create text boxes using the CreateControl method of the Form object,
but only when the form is open in Design view. An alternative is to create
as many text boxes as you may need in advance, and toggle their Visible
property.
 
Back
Top