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

Lock Table Query

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
NZ
I have a form which has a button that initiates a ‘make table query’. This query extracts a single field which is used to populate a combo box. I use the combo box as a filter for a report.

If I run the make table query a second time the following error message occurs, “The database engine could not lock table tblFleetDD because it is already in use by another person or process.”

How do I sort this out?


Hayton McGregor

 
Removing the RowSource from the combobox before running again should do it.
 
Remou thanks for your reply. Could you please help with the code. This is the code for the combo box.

On Error GoTo Err_Command172_Click

Dim stDocName As String


stDocName = "qryVehiclesDDM"
DoCmd.OpenQuery stDocName, acNormal, acEdit


Exit_Command172_Click:
Exit Sub

Err_Command172_Click:
MsgBox Err.Description
Resume Exit_Command172_Click

Many Thanks
Greg

Hayton McGregor

 
Ok. Try this:

Code:
On Error GoTo Err_Command172_Click

    Dim stDocName As String
    
    Me.cboFleet.RowSource=""
    stDocName = "qryVehiclesDDM"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    

Exit_Command172_Click:
    Exit Sub

Err_Command172_Click:
    MsgBox Err.Description
    Resume Exit_Command172_Click
 
Thanks Remou, I added some code for the rowsource

On Error GoTo Err_Command172_Click

Dim stDocName As String

Me.cboFleet.RowSource = ""


stDocName = "qryVehiclesDDM"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me.cboFleet.RowSource = "SELECT DISTINCTROW tblFleetDD.FltNbr FROM tblFleetDD ORDER BY tblFleetDD.FltNbr;"


Exit_Command172_Click:
Exit Sub

Err_Command172_Click:
MsgBox Err.Description
Resume Exit_Command172_Click

Cheers

Hayton McGregor

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top