mahinder.yadav 0 Newbie Poster

hi friends
i am new in vb coding. i have two tables in ms access
table 1 containing location column and id
and table 2 containing id, name and date1, date 2...date 30

i have made form design in visual basic with "name" label with combo1 that selecting data from table2 containing "name" coloumn data
and i also have made form design with "location" label with combo3 that selecting data from table1 containing "location" coloumn data, and combo2 for date, and i also made "save" command button to save this combo data..
my access file name is "staff.mdb"

i have made code for combo1 and combo2 it's working

Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Dim comm As ADODB.Command
Dim str As String
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Desktop\staff.mdb"
conn.Open
Set comm = New ADODB.Command
Set comm.ActiveConnection = conn
comm.CommandText = "SELECT NAME FROM Table2"
comm.CommandType = adCmdText
Set rs = comm.Execute

Do Until rs.EOF = True
Combo1.AddItem rs!Name
rs.MoveNext
Loop

Set comm = New ADODB.Command
Set comm.ActiveConnection = conn
comm.CommandText = "SELECT LOCATION FROM Table1"
comm.CommandType = adCmdText
Set rs = comm.Execute

Do Until rs.EOF = True
Combo3.AddItem rs!LOCATION
rs.MoveNext
Loop

Set rs = Nothing
Set comm = Nothing
Set conn = Nothing

End Sub

i can select the data in combo1 and combo2

now i want to know the code for "save" command button so that the data from combo 3 that is location will save in table2 in date1, date2, date3, date4...according to the date of month so that attendence will be taken from this button as a location name...

please help me in code...

thank you in advance...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.