L
Lez
Hi Guys,
I have a combo box on a subform that allows the user to search for items in
a combo based on the characters they enter. The issue is that it my subform
requires a FK as soon as you start to enter text into the combo box.
I have commented out the strProd="" to try to avoid entering a record at
this point but it still requires a FK and fails. if anyone can suggest a way
in which I can enter a value without causing a record to be written would be
helpful
Thank you
This is the combo action:
Option Compare Database
Dim strProd As String
' on clicking on the combo box, reset the variable strProd to "", and make
the combo box display blank: select the event handlers from the Event tab in
the properties window.
Private Sub cboProduct_Enter()
'strProd = ""
cboProduct = strProd
End Sub
' on each key press compile a string of the keys pressed and adjust the row
source query by adding a WHERE clause to search for the characters entered
Private Sub cboProduct_KeyPress(KeyAscii As Integer)
strProd = strProd & Chr(KeyAscii)
cboProduct.RowSource = "SELECT SKU_ManFRef, SKU_ProdName, SKU_ID FROM
dbo_vProductSKU_grouped WHERE SKU_ProdName Like '*" & strProd & "*';"
End Sub
I have a combo box on a subform that allows the user to search for items in
a combo based on the characters they enter. The issue is that it my subform
requires a FK as soon as you start to enter text into the combo box.
I have commented out the strProd="" to try to avoid entering a record at
this point but it still requires a FK and fails. if anyone can suggest a way
in which I can enter a value without causing a record to be written would be
helpful
Thank you
This is the combo action:
Option Compare Database
Dim strProd As String
' on clicking on the combo box, reset the variable strProd to "", and make
the combo box display blank: select the event handlers from the Event tab in
the properties window.
Private Sub cboProduct_Enter()
'strProd = ""
cboProduct = strProd
End Sub
' on each key press compile a string of the keys pressed and adjust the row
source query by adding a WHERE clause to search for the characters entered
Private Sub cboProduct_KeyPress(KeyAscii As Integer)
strProd = strProd & Chr(KeyAscii)
cboProduct.RowSource = "SELECT SKU_ManFRef, SKU_ProdName, SKU_ID FROM
dbo_vProductSKU_grouped WHERE SKU_ProdName Like '*" & strProd & "*';"
End Sub