Forum Discussion
BrianC42
Mar 14, 2024Copper Contributor
Populate a field based off partial information in another field
So, I know a few people have posted about something similar, but I have a weird twist to throw into it. I'm building a database to assist us with radio check-out/check-in for events we throw. Cur...
Woldman
Apr 03, 2024Iron Contributor
Hi BrianC42
I've attached an example Access database that addresses your question. It contains a sample form with a barcode and type field. If you enter a barcode starting with an "A" the type field changes to "Radio" and likewise to "Battery" when you enter a barcode starting with a "B".
The type field filling works with this little VBA code for the form:
Private Sub txtBarcode_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case UCase(Mid(txtBarcode.Text, 1, 1))
Case "A"
txtType.Value = "Radio"
Case "B"
txtType.Value = "Battery"
Case Else
txtType.Value = ""
End Select
End Sub
It's just a simple implementation, but I hope this helps,
Tieme