Solved

simple or not?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now