How to store option button name and value in database

Started by venela, May 18, 2009, 04:12 PM

Previous topic - Next topic

venela

 
Hi,

i'm currently develop a system using VB 6.0 and Access 2003.

suppose user enter answer through the interface which is made up of option/ radio button.

user have to answer few question before getting the result and each answer entered then compare with the value stored in database. Each answer entered by user from each question will form a pattern of solution that will have specific result. Noted i also wanted to store result in database.

Here is my code,


'Rule1
' all option button value from different frame combine together
' this is example if user the to select certain option button
' how can i store this in database and call back in code?
If notfresh.Value = True And smelly.Value = True And yellowmescrp.Value = True Then

' below is the answer that suppose shows to user and each answer has weightage
' how can i store this also in database

gred.unripe = 0 'the weightage
gred.almostripe = 0 'the weightage
gred.ripen = 0 'the weightage
gred.emptybunch= 0 'the weightage
gred.smelly = 10 'the weightage

'Rule 2
ElseIf notfresh.Value = True And smelly.Value = True And yellworangemescrp.Value = True Then

gred.unripe = 0
gred.almostripe = 0
gred.ripen = 0
gred.emptybunch = 0
gred.smelly = 10


End If

pls suggest to me the design of database for above and thanks in adv for helping me.







_______________
Virtual Florist Shop
dbol

dhilipkumar


I think that depends on your coding style. In my case it would be caption and not name.

btw if you use control arrays the name property is the same but the index is different so using the name is not fool proof either.

btw you did not provide enough info to be able to help with database design.

To assign the caption to a database you would typically need a text field in the database and then in code you would have

Code:
RS("MyField")=MyOptionButton.Caption
And to save the value you would have a boolean field to store the value and code something like

Code:
RS("MyFieldValue")=MyOptionButton.Value