Need Help On Backing Up And Posting To And From A Database

just_askin
01-17-2005, 11:06 PM
i need help on this: back up payroll information for a certain payperiod and then create another payoll information for another payperiod. i made two tables for this which i named [payroll_info_history] and [employeeinfo_history]. i also need help on how i can post the payroll information again after backing it up.

i just need some tip on how to go about this... tnx.

hardrain
01-18-2005, 01:55 AM
You can save your back up file to .csv or .txt file (tab delimited) in able to save space.
You must create some procedures that will convert the recordset results to a desired format of file.

loquin
01-18-2005, 09:10 AM
What type of database?

just_askin
01-19-2005, 01:27 AM
What type of database?

it's an ms access database...

just_askin
01-22-2005, 09:13 PM
This is a code for the back-up of all files for a certain paydate (so that a new paydate can be created). I tried this and it’s not working. Is there anyone who can help me with this?
Please. tnx

Here’s the code:

Private Sub cmdBackup_Click()
Dim adoPrimaryRS As New Recordset
Dim adoPrimaryRS_1 As New Recordset

Dim chkdate As Date
Dim strsql As String

If Len(txtPayDate) = 0 Then
MsgBox " Please Enter Month End Salary date", vbInformation
txtPayDate.SetFocus
Exit Sub
End If
chkdate = Format(txtPayDate.Text, "dd-mm-yyyy")
Set adoPrimaryRS = New Recordset
' points to as the error
adoPrimary.Open "select max(PayDate) from tblDedAllow where format(PayPeriod,'dd-mm-yyyy') ='" & Format(chkdate, "dd-mm-yyyy") & "' ", con, adOpenForwardOnly, adLockPessimistic

If Format(chkdate, "dd-mm-yyyy") = Format(rs.Fields(0), "dd-mm-yyyy") Then
MsgBox " Already Back up records for this Date" & rs.Fields(0), vbInformation
Set rs = Nothing
Exit Sub
Else
strsql = " select * from tblDedAllow where format(PayPeriod,'dd-mm-yyyy') = '" & chkdate & "'"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, con, adOpenForwardOnly, adLockPessimistic

If adoPrimaryRS_1.RecordCount = 0 Then
MsgBox " No records for this date : " & chkdate, vbInformation
Set adoPrimaryRS_1 = Nothing
Exit Sub
Else
con.Execute "INSERT INTO tblDedAllowHistory select *tblDedAllow"
con.Execute "INSERT INTO tblPayrollHistory SELECT A.* FROM tblPayroll A ,tblDedAllow B WHERE A.Num = B.Num"
con.Execute "UPDATE tblPayrollHistory SET PayPeriod = '" & chkdate & "' WHERE PayPeriod IS NULL "
adoPrimaryRS_1.Close
Set adoPrimaryRS_1 = Nothing
End If

MsgBox " Records Backup..."
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub


One more thing, should I want to access the files, I have backed up, how can I do it? How can I “re-post” (is that the right term) the files? Tnx.

MKoslof
01-23-2005, 08:39 AM
An Access database is just a flat file. Why not just compact and repair the database or use FileCopy() to make a backup of your database. The entire database is evaluated as one big file.

just_askin
01-24-2005, 03:24 AM
are there any example that you can give about using the FileCopy() ? tnx again.

MKoslof
01-24-2005, 04:49 PM
That should be "CopyFile"..a slip of the tongue, LOL :)

Here is a past thread with an example:

http://www.xtremevbtalk.com/showthread.php?t=185329

just_askin
01-25-2005, 04:22 AM
tnx again.

MKoslof
01-25-2005, 04:20 PM
Good luck :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum