Sorry, me again. Another one of my projects. This time for organising and controling stock. It uses a VB6 front form and access as the database. There are more than 50 items in the db and I would like to reduce the amount of code in the app.
If the user enters 'stockitem1' into the textbox as a barcode, it runs an SQL.
If the user enters 'stockitem2' into the textbox as a barcode, it runs an SQL etc.
Each SQL performs exactly the same function. I was hoping to just have one line of SQL code and somehow have the app recognise the barcode number in the textbox.
So instead of having 50 lines and SQLs each with a different txtSearch number I could have something in place of the 123456 so it knows which item it is.
Sorry if it's difficult to understand but it's difficult to explain.
TIA
If the user enters 'stockitem1' into the textbox as a barcode, it runs an SQL.
If the user enters 'stockitem2' into the textbox as a barcode, it runs an SQL etc.
Each SQL performs exactly the same function. I was hoping to just have one line of SQL code and somehow have the app recognise the barcode number in the textbox.
Code:
If txtSearch = "123456" Then
Set rs = conn.Execute("UPDATE tblStock SET kitdate = #" & Format(Now(), "dd/mmm/yy") & "#, quantity = quantity + 5 WHERE [reagent] = '" & txtSearch.Text & "'")
So instead of having 50 lines and SQLs each with a different txtSearch number I could have something in place of the 123456 so it knows which item it is.
Sorry if it's difficult to understand but it's difficult to explain.
TIA