Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Combo Box and Recordset Help

 
   Database Help (Home) -> Visual Basic RSS
Next:  Run-time error, type mismatch 13  
Author Message
Utf-8BVGhvbWFzIE5v

External


Since: Jun 01, 2004
Posts: 1



(Msg. 1) Posted: Tue Jun 01, 2004 12:06 pm
Post subject: Combo Box and Recordset Help
Archived from groups: microsoft>public>vb>database (more info?)

I have a VB 6 program that contains a form with a data control and a combo box. The combo box contains numbers 1-10, and the data control is linked to an Access table that contains fields Name, and 1-10. I want to press a button on the form, and have a value written to the proper field based on the value in the combo box. So If the users choose 5 in the combo box, I want the data to be written to field 5 in my table. I can code it the really long way:

if cboWeek.Text = "1" then
data1.recordset![1] = text1.text
elseif cboWeek.Text = "2" then
data1.recordset![2] = text1.text

so on

but I have to do something like this multiple times in my program.

There must be a way to say something like: data1.recordset[cboWeek.Text], but I am not sure of the syntax.

Please help!

 >> Stay informed about: Combo Box and Recordset Help 
Back to top
Login to vote
Bob Butler

External


Since: Jul 07, 2003
Posts: 64



(Msg. 2) Posted: Tue Jun 01, 2004 12:39 pm
Post subject: Re: Combo Box and Recordset Help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Thomas Nowak" <tnow1209.DeleteThis@hotmail.com> wrote in message news:BB60DEB6-
0BDC-4CD5-A0A5-8369FCBC4029.DeleteThis@microsoft.com
<cut>
 > There must be a way to say something like:
 > data1.recordset[cboWeek.Text], but I am not sure of the syntax.

try
data1.recordset.fields(clng(cboweek.text)).value=text1.text

or, assuming the combobox is in numeric order:
data1.recordset.fields(cboweek.listindex+1).value=text1.text

--
Reply to the group so all can participate
VB.Net... just say "No"<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Combo Box and Recordset Help 
Back to top
Login to vote
Utf-8BVG9tIE5vd2Fr

External


Since: Jun 02, 2004
Posts: 1



(Msg. 3) Posted: Wed Jun 02, 2004 9:16 am
Post subject: Re: Combo Box and Recordset Help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Worked like a charm. Thanks for your help.
 >> Stay informed about: Combo Box and Recordset Help 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
How to do a SELECT on a RecordSet - How would I do a SELECT on a ADODB.RecordSet? I have created the recordset from an Oracle database using a Select statement with a Group By. Now I need to Select from that result and further Group By and Sum. The logic of the statements don't allow for....

sql query returns in wrong format - Hi, Hope someone can help me with this. I have MS SQL 2000 database where i have Table "PriceList" and there a column "Pricemk" wich is data type "money". All data in this column is in form "10001,35". So why when...

arrays - is there a way to concatenate the contents of an array (looping through the array) and storing each item in a comma delimited string? Thanks!

DataReport PageBreak - Hi everyone, I would like to know how to force pagebreak in a datareport for example after 5 records printed. Thank you all

Possible Use of a Cursor - I have a complex query that I hope I can explain it well enough for everyone to understand. I have a table that contains information for work instructions. Contained in the table are "MACHINE_PROC" these are groupings of machining processes....
   Database Help (Home) -> Visual Basic All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]