|
|
 |
| VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 9th, 2009, 01:06 AM
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
variable field names
hi!
pls help me how to do this?
my form has two combo box, cboLoanType, cboField and a text box, txtAmount
- users click cboLoanType(which correspond to names of tables of loan e.g. "emergency loan", "appliance loan", "financing loan" etc.
- on click event of cboLoanType this is what happened:
Dim rsDBName As ADODB.Recordset
Dim txtFieldName() As String
Private Sub cboLoanType_Click()
Set rsDBName = New ADODB.Recordset
Dim txtDBname As String
Dim i As Integer
'retrieve the name of the table and open it
txtDBname = "select * from " & cboLoanType.Text
rsDBName.Open txtDBname, cnn, adOpenStatic, adLockOptimistic
' then loop to get the field names and add to cboField items
With cboField
.Clear
For i = 1 To rsDBName.Fields.Count - 1
ReDim txtFieldName(i)
txtFieldName(i) = rsDBName.Fields.Item(i).Name
.AddItem "" & txtFieldName(i)
Next i
End With
End Sub
clicking cboField gives users list of fields to choose where to post payment
later on the save button this is what i can't figure out how to do it.
i'm trying to save now the content of text box(txtAmount) to the field corresponding to the value of cboField in the table which cboLoanType combo box holds.
any help would be appreciated very very much. thank you
|

January 9th, 2009, 06:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 1,947
Thanks: 5
Thanked 30 Times in 29 Posts
|
|
Hi there..
I don't remember if you can save the value the same way you recover it (RS.fields.item(name).value)... but if not, you can build a simple SQL to store the value, something like: UPDATE tablename SET fieldname = value. You have all the info for this...
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|

January 11th, 2009, 07:46 PM
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by gbianchi
Hi there..
I don't remember if you can save the value the same way you recover it (RS.fields.item(name).value)... but if not, you can build a simple SQL to store the value, something like: UPDATE tablename SET fieldname = value. You have all the info for this...
|
thanks bro for your time spent. God bless you.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |