Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

simple or not?

Posted on 2001-06-19
5
Medium Priority
?
138 Views
Last Modified: 2010-05-02
Hi!

I have a lot of textbox controls on form and their names are written in DB table_1 in column fields like text1, text2, text3?
When I want to save user?s input I want to generate sql (INSERT INTO?)  so I read all from table_1 and replace in sql sentence with theirs value.

I tried like this

dim usr_input as textbox
usr_input = recordset!fields
msgbox usr_input.text

text1.text value is TEST
and TEST should be returned
0
Comment
Question by:Mitja100
  • 3
5 Comments
 
LVL 3

Expert Comment

by:nigelrowe
ID: 6206092
You can get the field names from the recordset(something like this...

sqlclause = "SELECT * FROM mytable"
Set Rs = DBConn.Execute(sqlclause)
For Each Field In Rs.Fields
 MsgBox Field.Name
Next


Is this what you're after?
0
 
LVL 5

Accepted Solution

by:
GeoffKell earned 400 total points
ID: 6206158
I thought you wanted the column name to be the textbox name. If so try

sqlclause = "SELECT * FROM mytable"
Set Rs = DBConn.Execute(sqlclause)
For Each Field In Rs.Fields
  MsgBox Me.Controls(Field.Name).Text
Next

Use the column name (Field.Name) as a lookup into the controls on the form.

Regards
GK
0
 

Author Comment

by:Mitja100
ID: 6206160
nigelrowe:
Accessing DB and reading data is not problem.
Actually in first DB I have list of names of all textboxes (text1, text2, text3), and I want to write values (user will input them) of this textboxes in second DB (value_of_text1, value_of_text3, value_of_text3).

Mitja
0
 

Author Comment

by:Mitja100
ID: 6206288
nigelrowe:
Accessing DB and reading data is not problem.
Actually in first DB I have list of names of all textboxes (text1, text2, text3), and I want to write values (user will input them) of this textboxes in second DB (value_of_text1, value_of_text3, value_of_text3).

Mitja
0
 

Author Comment

by:Mitja100
ID: 6206298
Thanx GeoffKell!

Me.Controls(Field.Name).Text

This is exactly what I was looking for.


Mitja
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question