Code:
Public Function getdataintotable(rs1 As ADODB.Recordset, tablename1 As String)
Dim strquery As String
Dim no1 As Integer
Dim count1 As Integer
Dim count2 As Integer
Dim count3 As Integer
Dim temp() As String
Dim strval As StringstrValues = "'" & rs1.fields(0).Name & "_" & rs1.fields(1).Name & "',"
For i = 0 To rs1.fields.count - 1
no1 = InStr(rs1.fields(i).Name, "BET") Or InStr(rs1.fields(i).Name, "RAISE") Or InStr(rs1.fields(i).Name, "CALL")
If no1 > 0 Then
count1 = count1 + 1
strFields = strFields & "Valeur" & count1 & ","
strValues = strValues & "'" & rs1.fields(i).Name & "',"
End If
Next
strFields = Left(strFields, Len(strFields) - 1)
strValues = Left(strValues, Len(strValues) - 1)
CurrentDb.Execute "Insert into [" & tablename1 & "](ID, " & strFields & ") VALUES(" & strValues & ")"
count1 = 0
count2 = 0
rs1.MoveFirst
Do While Not rs1.EOF
strquery = "Insert into [" & tablename1 & "] values ('" & rs1.fields(0).Value & "_" & rs1.fields(1).Value & "',"
For i = 0 To rs1.fields.count - 1
count1 = count1 + 1
no1 = InStr(rs1.fields(i).Name, "BET") Or InStr(rs1.fields(i).Name, "RAISE") Or InStr(rs1.fields(i).Name, "CALL")
If no1 > 0 Then
count2 = count2 + 1
strval = Str(rs1.fields(count1 - 1).Value)
temp = Split(strval, ".")
If temp(0) <> " " Then
strquery = strquery & CInt(temp(0)) & ","
Else
strquery = strquery & CInt(strval) & ","
End If
End If
Next
strquery = Left(strquery, Len(Trim(strquery)) - 1)
count2 = count2 + 1
count3 = 7 - count2
For j = 1 To count3
strquery = strquery & ", Null"
Next
strquery = strquery & ")"
CurrentDb.Execute strquery
count1 = 0
count2 = 0
count3 = 0
rs1.MoveNext
Loop
createdb (tablename1)
End Function