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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

requery help

Status
Not open for further replies.

kronar30

Programmer
Sep 8, 2004
74
US
I have a form [frmDeleteBids] based on a query 'BidsOnly' of my Job table. After I delete a record i want the query to show the table without the deleted record.

I have tried using
BidsOnly.Requery
Forms!frmDeleteBids.Requery
frmDeleteBids.Requery
and
Requery

None seem to work and I trap an on error condition.

How do I do this??
 
maybe you could post all of the code and the error you are receiving ... your requery examples use 2 form names ..... if frmDeletebids is a subform then requery the subform not the form contained within it

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
How are ya kronar30 . . .

I'm confused as [blue]this deletion process you mention is a common access navigational affair[/blue] ... you select the [blue]Record Selector[/blue] of the record in question and hit the [blue]Delete Key![/blue]. Access does all the rest automatically! Of course ... [blue]this is for a bound form![/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
'Here is the query the form (not subform) is based on which I would like it to requery:'

SELECT *
FROM JB_Jobs
WHERE JB_Jobs.JB_JoborBid = No;

'form is dynaset, continous form'

'Here is the code the delete button calls on click:'

Dim delBid As String
On Error GoTo deleteRecordsError
Stop
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
Set JBTrec = db.OpenRecordset("JBT_EmpTime", dbOpenDynaset)
Set JBMrec = db.OpenRecordset("JBM_JobMatList", dbOpenDynaset)
Set JBOrec = db.OpenRecordset("JBO_JobOverheads", dbOpenDynaset)

'delete this job and all related records
delstrSql = "JB_Deletesw = true and JB_JoborBid = false"
JBrec.FindFirst delstrSql

Do While Not JBrec.NoMatch
delBid = JBrec(0)
Call DeleteAllChildRecords
MsgBox " Ready to delete bid " & strQuote & delBid & strQuote


'MsgBox "Found matching Job record"
JBrec.Delete
MsgBox "Deleted " & strQuote & delBid & strQuote & " Bid record"
JBrec.FindFirst delstrSql
If JBrec.NoMatch Then
MsgBox "findnextfirst Bid is no match"
Requery *** does not work?
End If
Loop
If JBrec.NoMatch Then
MsgBox "There are no Bid records to delete"
Call Form_Close
End If

Exit Sub

'And, Yes autodelete would probably be eadier however I started doing the delete by code and would like to know how various things work in Access 97'
'Thanks'
 
Dim delBid As String
On Error GoTo deleteRecordsError
[red]Stop[/red]
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
Set JBTrec = db.OpenRecordset("JBT_EmpTime", dbOpenDynaset)
Set JBMrec = db.OpenRecordset("JBM_JobMatList", dbOpenDynaset)
Set JBOrec = db.OpenRecordset("JBO_JobOverheads", dbOpenDynaset)

:) on first glance

also with Requery:The Requery method updates the data underlying a specified form, or a control that's on the [blue]active form[/blue]

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Were you pointing out something that I should change, MazeWorx?

So I should use 'frmDeleteBids.Requery' as the current form name is frmDeleteBids?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top