steve711
03-27-2005, 06:42 AM
Hello Fellas. I need some help. I am working on splitting my database as it is used on several computers and that seems the best thing to do.
Everything works except this one routine.
Sorry I don't know how to paste this in a code window so here it goes. The database (tables) are on the server and I have linked them correctly. I know this because every other aspect of the program works except for this:
I am pretty sure it has something to do with the setting but I am not sure how to fix it. I am also sure that there is probably a more efficient way of writing this sub as well. So I am thick skinned and would enjoy a critque as well from the pros out there.
---------
Dim frmEnt As Form_frmEntry
Dim rec, recEntry, recDate As Recordset
Dim db As Database
Dim reccurrentpay, rec_rev_total As Recordset
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblPay_Period")
Set frmEnt = Forms!frmEntry!
Set rec_rev_total = db.OpenRecordset("qry_rev_total")
Set reccurrentpay = db.OpenRecordset("qry_currentpay")
On Error Resume Next
'Compare the entered date with the Pay Period to determine which period we are in
rec.Index = "tblEndPayPeriod"
entereddate = frmEnt.txtDate.Value
rec.Seek "<", entereddate 'frmEnt.txtDate.Text
'Need to add 1 day to this date for the pay period
startdate = rec("tblEndPayPeriod") + 1
'Place the start and ending dates of the pay period
frmEnt.txtStart.Value = startdate
rec.MoveNext
frmEnt.txtEnd.Value = rec("tblEndPayPeriod")
rec.Close
'Subroutine checks through the Entry recordset for matches within the current
'pay period. Then adds up the pay period and enters it into the form
numrec = db.OpenRecordset("qry_rev_total").RecordCount
recordcounter = 0
rec_rev_total.MoveFirst
Do
recordcounter = recordcounter + 1
searchPilot = rec_rev_total("tblPilot").Value
searchDate = rec_rev_total("tblDate").Value
If searchPilot = frmEnt.cboPilots.Value Then
If searchDate >= frmEnt.txtStart And searchDate <= frmEnt.txtEnd Then
paytime = paytime + rec_rev_total("Sum Of tblRevenue_Hours").Value
frmEnt.txtPay_Period.Value = paytime
End If
End If
rec_rev_total.MoveNext
Loop Until recordcounter + 1 > numrec
Everything works except this one routine.
Sorry I don't know how to paste this in a code window so here it goes. The database (tables) are on the server and I have linked them correctly. I know this because every other aspect of the program works except for this:
I am pretty sure it has something to do with the setting but I am not sure how to fix it. I am also sure that there is probably a more efficient way of writing this sub as well. So I am thick skinned and would enjoy a critque as well from the pros out there.
---------
Dim frmEnt As Form_frmEntry
Dim rec, recEntry, recDate As Recordset
Dim db As Database
Dim reccurrentpay, rec_rev_total As Recordset
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblPay_Period")
Set frmEnt = Forms!frmEntry!
Set rec_rev_total = db.OpenRecordset("qry_rev_total")
Set reccurrentpay = db.OpenRecordset("qry_currentpay")
On Error Resume Next
'Compare the entered date with the Pay Period to determine which period we are in
rec.Index = "tblEndPayPeriod"
entereddate = frmEnt.txtDate.Value
rec.Seek "<", entereddate 'frmEnt.txtDate.Text
'Need to add 1 day to this date for the pay period
startdate = rec("tblEndPayPeriod") + 1
'Place the start and ending dates of the pay period
frmEnt.txtStart.Value = startdate
rec.MoveNext
frmEnt.txtEnd.Value = rec("tblEndPayPeriod")
rec.Close
'Subroutine checks through the Entry recordset for matches within the current
'pay period. Then adds up the pay period and enters it into the form
numrec = db.OpenRecordset("qry_rev_total").RecordCount
recordcounter = 0
rec_rev_total.MoveFirst
Do
recordcounter = recordcounter + 1
searchPilot = rec_rev_total("tblPilot").Value
searchDate = rec_rev_total("tblDate").Value
If searchPilot = frmEnt.cboPilots.Value Then
If searchDate >= frmEnt.txtStart And searchDate <= frmEnt.txtEnd Then
paytime = paytime + rec_rev_total("Sum Of tblRevenue_Hours").Value
frmEnt.txtPay_Period.Value = paytime
End If
End If
rec_rev_total.MoveNext
Loop Until recordcounter + 1 > numrec