Option Group associate selection from the table

H

hoachen

I am trying to think which way is most efficient way to do this and need
everyone help. I create a group option that have radiobtn1: Buy radiobtn2:
Sell, radiobtn3: donate then next to it have a combobox that have a list of
query from the table that contains: discount, new and use. For example1: When
a sell radiobutton selected and "new" is select then it will store at the
table column named: sell new. For example2:When a buy radiobutton selected
and "new" is select then it will store at the table column named: buy new.

So for this type of procedure i neend to have vb to code. Is there anywhere
i can get tutorial or similar to this so that i can sucessfully create this.

Thank you everyone try to help or read my question.
Sincerely Thanks hoachen
 
M

Margaret Bartley

I would have two sets of radio buttons - one is Buy, Sell, Donate, the
second is New, Discount, Used.

I would then have a command button that looks at the two sets of buttons and
adds them to the table:

Sub CmdGo_Click
Dim strAction$, strType$
dim strSQL$

Select Case optAction
Case 1
strAction = "Buy"
Case 2
strAction = "Sell"
Case 3
strAction="Donate"
End Select

Select Case optType
Case 1
strType = "New"
Case 2
strType = "Discount"
Case 3
strType ="Used"
End Select

strSQL="INSERT INTO [MyTable] (TransactionCode) SELECT '" & strAction &
strType';"
DoCmd.RunSQL strsSQL

End Sub


This assumes you are going to concatenate the two options. If you want to
separate into two fields, just modify the strSQL value:

strSQL="INSERT INTO [MyTable] (Action,Type) SELECT '" & strAction & '","' &
"'strType';"
 
H

hoachen

Thank you Margaret for you help, can you explain what it means
"Transactioncode" on the sql statement

strSQL="INSERT INTO [MyTable] (TransactionCode) SELECT '" & strAction &
strType';"
DoCmd.RunSQL strsSQL


Margaret Bartley said:
I would have two sets of radio buttons - one is Buy, Sell, Donate, the
second is New, Discount, Used.

I would then have a command button that looks at the two sets of buttons and
adds them to the table:

Sub CmdGo_Click
Dim strAction$, strType$
dim strSQL$

Select Case optAction
Case 1
strAction = "Buy"
Case 2
strAction = "Sell"
Case 3
strAction="Donate"
End Select

Select Case optType
Case 1
strType = "New"
Case 2
strType = "Discount"
Case 3
strType ="Used"
End Select

strSQL="INSERT INTO [MyTable] (TransactionCode) SELECT '" & strAction &
strType';"
DoCmd.RunSQL strsSQL

End Sub


This assumes you are going to concatenate the two options. If you want to
separate into two fields, just modify the strSQL value:

strSQL="INSERT INTO [MyTable] (Action,Type) SELECT '" & strAction & '","' &
"'strType';"



hoachen said:
I am trying to think which way is most efficient way to do this and need
everyone help. I create a group option that have radiobtn1: Buy radiobtn2:
Sell, radiobtn3: donate then next to it have a combobox that have a list
of
query from the table that contains: discount, new and use. For example1:
When
a sell radiobutton selected and "new" is select then it will store at the
table column named: sell new. For example2:When a buy radiobutton selected
and "new" is select then it will store at the table column named: buy new.

So for this type of procedure i neend to have vb to code. Is there
anywhere
i can get tutorial or similar to this so that i can sucessfully create
this.

Thank you everyone try to help or read my question.
Sincerely Thanks hoachen
 
M

Margaret Bartley

"Transactioncode" is just a field name I made up for the field in your table
that you want to put the result it.
You would use the fieldname of your table that will hold the code you are
saving to the file.

hoachen said:
Thank you Margaret for you help, can you explain what it means
"Transactioncode" on the sql statement

strSQL="INSERT INTO [MyTable] (TransactionCode) SELECT '" & strAction &
strType';"
DoCmd.RunSQL strsSQL


Margaret Bartley said:
I would have two sets of radio buttons - one is Buy, Sell, Donate, the
second is New, Discount, Used.

I would then have a command button that looks at the two sets of buttons
and
adds them to the table:

Sub CmdGo_Click
Dim strAction$, strType$
dim strSQL$

Select Case optAction
Case 1
strAction = "Buy"
Case 2
strAction = "Sell"
Case 3
strAction="Donate"
End Select

Select Case optType
Case 1
strType = "New"
Case 2
strType = "Discount"
Case 3
strType ="Used"
End Select

strSQL="INSERT INTO [MyTable] (TransactionCode) SELECT '" & strAction &
strType';"
DoCmd.RunSQL strsSQL

End Sub


This assumes you are going to concatenate the two options. If you want to
separate into two fields, just modify the strSQL value:

strSQL="INSERT INTO [MyTable] (Action,Type) SELECT '" & strAction &
'","' &
"'strType';"



hoachen said:
I am trying to think which way is most efficient way to do this and need
everyone help. I create a group option that have radiobtn1: Buy
radiobtn2:
Sell, radiobtn3: donate then next to it have a combobox that have a
list
of
query from the table that contains: discount, new and use. For
example1:
When
a sell radiobutton selected and "new" is select then it will store at
the
table column named: sell new. For example2:When a buy radiobutton
selected
and "new" is select then it will store at the table column named: buy
new.

So for this type of procedure i neend to have vb to code. Is there
anywhere
i can get tutorial or similar to this so that i can sucessfully create
this.

Thank you everyone try to help or read my question.
Sincerely Thanks hoachen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top