Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

simple or not?

Posted on 2001-06-19
5
Medium Priority
?
136 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

719 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