how to delete a particular record in all the tables?
i am not sure wat r the tables as i wil create them at run time
i am maintaining an attendance for employees.
a table wil be added for every month and when i delete a employee, his record should be removed from all the tables.
i am using dao.


thanks in advance

for that you need to design your database accordingly.

and designing tables at run time and working on them only sounds good only if you do not know how that works.

First question is... If you are creating an employee database, why do you want to create duplicate tables and duplicate records? Then, when an employee employment ends, why do you want to delete the employees records? These records could have important tax information.

Perhaps a bit better explanation/plan of what you want to do and why might help us to help you better.


Good Luck

^^^^^^^
i am not using duplicate tables and recordset
actually i wil create a new table every month to maintain attendance as i cnt have all in the same table.

Say for instance, If we try to delete a record that is displayed in the Text box then:

Set Rs = New ADODB.Recordset
Rs.Open "SELECT * FROM tblVendor WHERE txtVendor='" & txtVendor.Text(txtVendor) & "'", CN, adOpenStatic, adLockOptimistic

With Rs

If MsgBox("Do you really want to delete this record ? " + .Fields("txtVendor") + "?", vbInformation + vbYesNo + vbDefaultButton2, "Are you Sure?") = vbYes Then

If Not Rs.EOF Then

.Delete

End If
End If
End With

Set Rs = Nothing
CN.CursorLocation = adUseClient
Set Rs = New ADODB.Recordset
Rs.Open "SELECT * FROM tblVendor", CN, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = Rs

Set Rs = Nothing

Me.txtVendor = ""

'/*if u are using VB 6.0 , the "Me" in the above line refers to the 'Form component's name.*/

cmdDel.Enabled = False

how to delete a particular record in all the tables?
i am not sure wat r the tables as i wil create them at run time
i am maintaining an attendance for employees.
a table wil be added for every month and when i delete a employee, his record should be removed from all the tables.
i am using dao.


thanks in advance

And why can you not keep the attendance records in the same table?

Be a part of the DaniWeb community

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