save record to a different table

eshai

Registered User.
Local time
Today, 20:32
Joined
Jul 14, 2015
Messages
195
i have 2 tables that have the same fields. one called "students" one called "studentsinhold" for Each table i have a form. now i have 2 buttons for the form "studentinhold" What I want to do is that when i press the Accepted button it well save the record in "students" table and delete the record from "studentsinhold" table. and the second button(called not Accepted) well do the same but save it to 3rd table. i well use the same code. this db have 4 end user and Linked tables
"i need vba code"
 
You don't need vba code.
Use a macro, in it put your queries....
Append query to add data,
Delete query to delete.
 
You don't need VBA code. And you definitely don't need three tables. One does not use the structure of the database to record information, which is what you are doing when designating status by the table where the record is located.

There should only be one table for this data. An extra field would indicate the Status as Hold, Accepted or Not Accepted. The field would be displayed using a combobox having the three choices with a default as hold.

Use a query when you want to display all the records of a particular status.
 
I'd suggest handling the situation differently.

Rather than having 3 tables, just have the one, tblStudents. Add a new field called say, StudentStatus.

New students are entered with a Pending status, those accepted change the status to say Accepted, and those not accepted, to say Rejected.

It's then very easy to filter one form to show different status types.
 
You don't need vba code.
Use a macro, in it put your queries....
Append query to add data,
Delete query to delete.

thank you all
i didn't build this db i got it to fix and add things. the db is already working for a long time so i don't want to get into it
my code so far
Code:
Private Sub btn75_Click()
   
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("students")



With rs
.AddNew
here how do i put all fields
.Update
End With
 
Clearly, since you are implementing it, the database doesn't already have the facility to move the records between the tables. Don't waste you time going the wrong way. Fix the problem instead because wrong structure will continue to cause problems that require clumsy workarounds like you are engaging in now.
 
Clearly, since you are implementing it, the database doesn't already have the facility to move the records between the tables. Don't waste you time going the wrong way. Fix the problem instead because wrong structure will continue to cause problems that require clumsy workarounds like you are engaging in now.

for now the system must keep working so i need a vba code
in the future i well build it from scratch
 

Users who are viewing this thread

Back
Top Bottom