Pass Though Queries/Stored Procedures to load combos

D

Don

Hello, I have an Access 2003 application that uses SQL Server 2000 as the
backend. On my invoice screen I use SQL pass though Queries to load certain
combos. Before I enter the invoice screen, I refresh my pass though query
using the QueryDef object. In the code below, I set it to use a stored
procedure that takes a parameter of the logon user to only show customers
that the user is allowed to see.

On the customer combo I set the row source to my pass though
query("spLookupInvoiceClientsStaff"). This all works well but when the
invoice screen is kept opened it seems to create a lock on the rows returned
to populate the combo box. How can I drop the connection once the pass
though query is done loading the combo.

Thanks

Don

Dim MyDB As Database

Set MyDB = DBEngine.Workspaces(0).Databases(0)

With MyDB.QueryDefs("spLookupInvoiceClientsStaff")
.SQL = "psp_InvoiceContactsStaff '" & gblSysUser & "'"
.Connect = SQLCONNECTSTRING
.ReturnsRecords = True
End With
 
Top