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

Open recordsets to edit data entered in a form

Status
Not open for further replies.

bonnief

Programmer
Jan 4, 2002
5
US
I use a technique several times in a user entry form. Multiple users are entering into this form at the same time. The entry gets slower and slower. Is my code shown below causing this slowdown? Thank you.

'Page 248 Access 97 Developer's Handbook:
'Define query parameters passed to query qsel607AccumBTicket
Dim dbs2 As Database
Dim qdf2 As QueryDef
Dim prm2 As Parameter
Dim rst2 As Recordset

Set dbs2 = CurrentDb()
Set qdf2 = dbs2.QueryDefs("qsel607AccumBTicket")
For Each prm2 In qdf2.Parameters
prm2.Value = Eval(prm2.Name)
Next prm2
Set rst2 = qdf2.OpenRecordset(dbOpenDynaset)

'------
With rst2

If rst2.RecordCount > 0 Then
Beep
Msgbox "Invalid material/batch combination. Please check your entry.", vbOKOnly, _
"Invalid material/batch combination"
strError = "Yes"
rst2.Close
DoCmd.OpenForm "frmMaterialBatchErrorsB", acNormal, "qsel607AccumBTicket", "", , acNormal
' cancel the event
DoCmd.CancelEvent
' and stop the macro
Exit Sub
End If

End With
'-----
 
There is an more efficient way to do this, but I would first try to compile your database and see if that makes a difference. Remember - if its not broke don't fix it.

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top