Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Need Help On Backing Up And Posting To And From A Database


Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2005, 11:06 PM
just_askin just_askin is offline
Centurion
 
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
Default 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.
Reply With Quote
  #2  
Old 01-18-2005, 01:55 AM
hardrain's Avatar
hardrain hardrain is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Manila, Philippines
Posts: 277
Default

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.
Reply With Quote
  #3  
Old 01-18-2005, 09:10 AM
loquin's Avatar
loquin loquin is offline
Google Hound

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,378
Default

What type of database?
__________________
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
Reply With Quote
  #4  
Old 01-19-2005, 01:27 AM
just_askin just_askin is offline
Centurion
 
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
Default

Quote:
Originally Posted by loquin
What type of database?
it's an ms access database...
Reply With Quote
  #5  
Old 01-22-2005, 09:13 PM
just_askin just_askin is offline
Centurion
 
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
Default

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.
Reply With Quote
  #6  
Old 01-23-2005, 08:39 AM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

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
Reply With Quote
  #7  
Old 01-24-2005, 03:24 AM
just_askin just_askin is offline
Centurion
 
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
Default

are there any example that you can give about using the FileCopy() ? tnx again.
Reply With Quote
  #8  
Old 01-24-2005, 04:49 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

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
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #9  
Old 01-25-2005, 04:22 AM
just_askin just_askin is offline
Centurion
 
Join Date: Jan 2005
Location: where old houses abound
Posts: 120
Default

tnx again.
Reply With Quote
  #10  
Old 01-25-2005, 04:20 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Good luck
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->