I have a variable, let's say intSale, that I need to be inserted into my Sales table, in the SalesType field. The variable is a number, being passed into the SalesType field which holds a number value... intSale holds the value of an option selected from an option group on a form. Here's the code I have, I'm just guessing at the cursor and lock types.
Private Sub Form_AfterInsert()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim intoption1 As Integer
Dim intoption2 As Integer
Dim intvalue As Integer
Dim intvalue1 As Integer
Dim intvalue2 As Integer
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.Open "Sales", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
intoption = [CableOptions]
Select Case intoption1
Case 1
intvalue1 = 0
Case 2
intvalue1 = 1
Case 3
intvalue1 = 2
Case 4
intvalue1 = 3
End Select
intoption2 = [HSIOPTIONS]
Select Case intoption2
Case 1
intvalue2 = 0
Case 2
intvalue2 = 30
Case 3
intvalue2 = 50
End Select
intvalue = intvalue1 + intvalue2
rs.Fields("SalesType".Value = intvalue
End Sub
Thanks,
Michael
Private Sub Form_AfterInsert()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim intoption1 As Integer
Dim intoption2 As Integer
Dim intvalue As Integer
Dim intvalue1 As Integer
Dim intvalue2 As Integer
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.Open "Sales", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
intoption = [CableOptions]
Select Case intoption1
Case 1
intvalue1 = 0
Case 2
intvalue1 = 1
Case 3
intvalue1 = 2
Case 4
intvalue1 = 3
End Select
intoption2 = [HSIOPTIONS]
Select Case intoption2
Case 1
intvalue2 = 0
Case 2
intvalue2 = 30
Case 3
intvalue2 = 50
End Select
intvalue = intvalue1 + intvalue2
rs.Fields("SalesType".Value = intvalue
End Sub
Thanks,
Michael