Hi Friends, i have some hundreds of childitem . i simple want when user type all the item child. in multiline text box .it needs to be added in the database .i have
stores table in access database .in which veryfirst field is storeid , and storename is there .and 3rd field is child .storeid +storename is a unique key.
but still i am confessing it is easier to insert all the child item altogether in the database like the following way .but i want at first storeid needs to be added .and
in the second fileld, and then their itemchild .itemchild is fixed for all the stores .like the following way .can anyone suggest me .
STOREID STOREID ITEM
HAYAT 101519 138771140
HAYAT 101519 138771220
HAYAT 101519 136055351
HAYAT 101519 135880295
HAYAT 101519 137339953
HAYAT 101519 138770788
HAYAT 101519 138770770
HAYAT 101519 117243954
HAYAT 101519 136823971
HAYAT 101519 136823989
HAYAT 101519 138823501
HERA 101518 138771140
HERA 101518 138771220
HERA 101518 136055351
HERA 101518 135880295
HERA 101518 137339953
HERA 101518 138770788
HERA 101518 138770770
HERA 101518 117243954
HERA 101518 136823971
HERA 101518 136823989
HERA 101518 138823501
stores table in access database .in which veryfirst field is storeid , and storename is there .and 3rd field is child .storeid +storename is a unique key.
but still i am confessing it is easier to insert all the child item altogether in the database like the following way .but i want at first storeid needs to be added .and
in the second fileld, and then their itemchild .itemchild is fixed for all the stores .like the following way .can anyone suggest me .
Code:
Public Sub Fillinthedabase()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
If Not OpenConnection(con) Then Exit Sub
Dim col As Collection
Dim n As Integer
Dim x() As String
Dim sql As String
Set col = New Collection
If Checkinput Then
x = Split(Text1.Text, vbNewLine)
sql = "Select * from Allocation "
rs.Open sql, con, adOpenDynamic, adLockOptimistic
For n = 0 To UBound(x)
col.Add (x(n))
rs.AddNew
rs.Fields("item") = x(n)
rs.MoveNext
Next
rs.Update
rs.Close
End If
End Sub
HAYAT 101519 138771140
HAYAT 101519 138771220
HAYAT 101519 136055351
HAYAT 101519 135880295
HAYAT 101519 137339953
HAYAT 101519 138770788
HAYAT 101519 138770770
HAYAT 101519 117243954
HAYAT 101519 136823971
HAYAT 101519 136823989
HAYAT 101519 138823501
HERA 101518 138771140
HERA 101518 138771220
HERA 101518 136055351
HERA 101518 135880295
HERA 101518 137339953
HERA 101518 138770788
HERA 101518 138770770
HERA 101518 117243954
HERA 101518 136823971
HERA 101518 136823989
HERA 101518 138823501