Solved

simple or not?

Posted on 2001-06-19
5
131 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 100 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
Reading the Contents of a Directory In Access VBA 5 68
MS Access Search and Replace Using VBA 6 70
vb6 connector to SQL Server 2 37
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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