 |
 |

01-17-2005, 11:06 PM
|
|
Centurion
|
|
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
|
|
Need Help On Backing Up And Posting To And From A Database
|
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.
|
|

01-18-2005, 01:55 AM
|
 |
Junior Contributor
|
|
Join Date: Dec 2003
Location: Manila, Philippines
Posts: 277
|
|
|
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.
|
__________________
It's been a while.
|

01-18-2005, 09:10 AM
|
 |
Google Hound
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,378
|
|
__________________
Lou
"I have my standards. They may be low, but I have them!" ~ Bette Middler
"It's a book about a Spanish guy called Manual. You should read it." ~ Dilbert
"To understand recursion, you must first understand recursion." ~ unknown
|

01-19-2005, 01:27 AM
|
|
Centurion
|
|
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
|
|
Quote:
|
Originally Posted by loquin
What type of database?
|
it's an ms access database...
|
|

01-22-2005, 09:13 PM
|
|
Centurion
|
|
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
|
|
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:
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.
|
|

01-23-2005, 08:39 AM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
|
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.
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

01-24-2005, 03:24 AM
|
|
Centurion
|
|
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
|
|
|
are there any example that you can give about using the FileCopy() ? tnx again.
|
|

01-24-2005, 04:49 PM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

01-25-2005, 04:22 AM
|
|
Centurion
|
|
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
|
|
|

01-25-2005, 04:20 PM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
Good luck 
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|