question

IvanTorr-4342 avatar image
0 Votes"
IvanTorr-4342 asked JackJJun-MSFT edited

Form open event

I have a from containing a combo box from which I can select a product. Once the product has been selected, it can be viewed or edited depending on your login password. So i have set 1 as admin that can edit items and 2 ,3 a. nd 4 as other users.

When i select the the item, the on click event on the "view product" works as it should, however when i close the form and select another product i get an error. "the Tblproduct list is being used by another user" . I should say that this is a stand alone system at the moment.

I also have another combo box that has the exact same code where i do not get the error.

any ideas would be great.

The "view product" code is below



Private Sub Command10_Click()
If Me!ProdResult.ListIndex = "-1" Then

         MsgBox "A selection is required from the dropdown list", vbCritical, "Required"
    
         Me!ProdResult.SetFocus
    
 Exit Sub

End If

  If Forms!Frmlogin1!PassNo <= 2 Then
     
  DoCmd.OpenForm "FrmProductSetup", acNormal, , "ProdId=" & [ProdResult], acFormEdit
     
    
 Else
    
 DoCmd.OpenForm "FrmproductSetup", acNormal, , "ProdId =" & [ProdResult], acFormReadOnly
    
 End If

End Sub

dotnet-visual-basicwindows-formsoffice-access-dev
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I do not see a Tblproduct.

0 Votes 0 ·

Thnaks for getting in touch.

The TblProducts is the table used for the combo box using a simple query

SELECT TblProdList.ProdID, TblProdList.ProdName, TblProdList.ProdActive, TblProdList.ProdFood
FROM TblProdList
WHERE (((TblProdList.ProdName) Like "" & [Forms]![FrmProdSearch]![prodSearchBox] & "") AND ((TblProdList.ProdActive)=IIf(([forms]![FrmProdsearch]![Frame34])=1,Yes,No)) AND ((TblProdList.ProdFood)=[Forms]![FrmProdsearch]![Frame23]))
ORDER BY TblProdList.ProdName;

The ProdSearchBox is a Textbox used for initiating the search
Frame34 splits the list into active/ inactive products using Boohlean function
frame 23 splits the list further into food products/ drink products and packaging

So the command 10 click is the "view product" button .

so th user typ[es the start of a product into the "ProdSearchBox" and hits TAB. The query Is run on an afterUpdate event.

the user selects a product fromthe combo box and then the "command10" button. "View Product" whick opens the FrmProductSetup.

the idea is that a hidden form "FRmLogin1" which is set to Invisible contains your login. Only people with a value of 1 can Edit the form.

Regards

Ivan




0 Votes 0 ·

@IvanTorr-4342 , Could you provide a sample code for me to reproduce your problem? It will be better for us to analyze your problem.

0 Votes 0 ·

0 Answers