Currently, I am creating an asset inventory system. In the system, I have 2 tables (IT Assets and Contacts) and 3 separate forms (AssetEntry-F, AssetChecking-F, and Employee-F). I am in the process of creating the AssetChecking-F form, that will serve the purpose of checking in and checking out the asset once it is scanned via barcode. On the form, I have a text box, in which the user will scan the barcode on the item, and then either click the button for check in (which will populate a date and change the status of "In Stock" field on the IT Assets Table to true) or click the check out button (which will prompt the user for the first and last name of the user via InputBox, set the timestamp of check out, and change the "In Stock" field status to False.
The problem that I'm having (with the Check-Out button) is how to set the variables that I have created for grabbing the First & Last Name to update the fields (First Name, Last Name) on the Contacts Table since the AssetChecking-F form has the record source set for "IT Assets". Here is an example of my VBA code in progress (I am open to all feedback)
Expand|Select|Wrap|Line Numbers
- Private Sub AssetOut_Click()
- Dim getOwnerFirst As String
- Dim getOwnerLast As String
- getOwnerFirst = InputBox("Please associate the device with an owner. Enter the owner's first name", [Get Owner - First Name])
- getOwnerLast = InputBox("Please enter the owner's last name", [Get Owner Last Name])
- If getOwnerFirst = “” Or IsNull(getOwnerFirst) Then
- ‘do Nothing
- Else
- If getOwnerLast = “” Or IsNull(getOwnerLast) Then
- ‘do Nothing
- Else
- Me.TimeOut = Date
- Me.[In Stock] = False
- End Sub