Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery Method isn't working

Status
Not open for further replies.

msreed

Programmer
Jul 25, 2003
21
US
I have a form/subform. After I update data (pay bills) in the subform I want to requery that subform. The subform only looks at unpaid bills. I do this by checking all bills I want to pay, then I hit a command button on the main form. This command hits the appropriate tables and pays bills. I used:

[Forms![frmHubPAYMENTS]![frmBILLSDuesub_OLD].Form.Requery]

to requery but its not working. I think my problem is that the subform doesn't just run from a table, it runs from a combination and filters, etc. The sub routine to pay the bills only opens the tables.

Any suggestions?
 
I tried using this code also, but no luck.

Me!frmBILLSDuesub_OLD.Requery

I do not receive any errors with anything I have done so far, it just simply doesn't perfom the function.
 
[Forms![frmHubPAYMENTS]![frmBILLSDuesub_OLD].Form.Requery]

I've never seen this bracketed like this. Where are you calling the command from ?

 
I didn't realize that I bracketed my statement, I didn't do that in the code. I realize that I should understand what your asking me, please excuse my ignorance, I am trying to do better on my terminology. What do you mean where am I calling the command from?
 
Code, I commented out the 2 things I've tried.

Call ResetUserID

Dim DB, DB_BE As Database
Dim rstToPay, rstPayments, rstActivity, rstDUE As Recordset
Set DB_BE = OpenDatabase("I:\InformationTechnology\Reporting&Invoicing\Reporting&InvoicingBackEnd\R&IBackEnd.mdb")
Set DB = CurrentDb
Set rstToPay = DB.OpenRecordset("qryToPay")
Set rstPayments = DB_BE.OpenRecordset("tblPayments")
Set rstActivity = DB_BE.OpenRecordset("tblBillActivity")

DoCmd.SetWarnings 0
With rstToPay
.MoveFirst
Do While Not .EOF
rstPayments.AddNew
rstPayments![HeaderID] = ![HeaderID]
rstPayments![InvoiceNo] = ![InvoiceNo]
rstPayments![BillDate] = ![BillDate]
rstPayments![ClientID] = ![ClientID]
rstPayments![DatePaid] = Me![txtPayDate]
rstPayments![Paid] = ![TotalFees]
rstPayments![CheckNo] = Me![txtCheckNo]
rstPayments![PaymentType] = Me![cmbCreditType]
rstPayments![Notes] = Me![txtCOMMENT]
rstPayments![ProcessDate] = Date
rstPayments![UserID] = intUserID
rstPayments.Update

rstActivity.Index = "HeaderID"
rstActivity.Seek "=", ![HeaderID]
rstActivity.Edit
If Me![cmbCreditType] = 1 Then
rstActivity![PaymentsApplied] = rstActivity![PaymentsApplied] + ![Balance]
Else
rstActivity![OtherApplied] = rstActivity![OtherApplied] + ![Balance]
End If
rstActivity![Balance] = 0
rstActivity![TotalPaid] = rstActivity![TotalPaid] + ![Balance]
rstActivity.Update
.MoveNext
Loop
End With
DoCmd.SetWarnings -1

Call UnCheckPayFlag

'Me!frmBILLSDuesub_OLD.Requery
'Forms![frmHubPAYMENTS]![frmBILLSDuesub_OLD].Form.Requery


Set DB = Nothing
Set DB_BE = Nothing
Set rstToPay = Nothing
Set rstPayments = Nothing
Set rstActivity = Nothing
'On Error GoTo 0
End Sub
 
Try this:

Dim myform as form

set myform =Forms![frmHubPAYMENTS]![frmBILLSDuesub_OLD]

myform.requery
myform.refresh
myform.repaint
 
Run time error '13' type mismatch, it debugs on set myform
 
I changed myform as form to my form as subform, it liked that but now it gets hung-up on refresh. I'll see what I can do about that.
 
I commented out both refresh and repaint. The code will now run but it still does not get rid of the record I just paid.
 
Is the data on the subform based on a query ? Does the queried data have some sort of flagged value that tells the form the bill has been paid ? It sounds like something isn't being flushed to disk somewhere between the two databases you have opened.

Its been a while since I did DAO but the command is something like databases(0).idle ????

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top