'Maybe this will get you started
Private Sub mscomm2_OnComm()
Dim sBarScan as string
If iFlag = 1 Then Exit Sub
If flag = 1 Then 'Text boxes empty?
For i = 0 To 2
txt(i) = ""
Next i
flag = 0
End If
sBarScan = left(MSComm1.Input, 12)
rs.Open ("SELECT * from ItemInfo where Identifier = '" & sBarScan & "'"

'ItemInfo is table in my db
iDeptNum = rs(3) 'Get Dept# for scanned item
DeptAmt = rs(2) 'Get amt for scanned item
SubAmt = SubAmt + rs(2) 'This is subtotal
txt(0) = txt(0) & rs(1) & vbCrLf 'Add itemDescript to display
txt(1) = txt(1) & FormatNumber(DeptAmt, 2) & vbCrLf 'Add amount of item to display
rs.Close
ScratchPad 'go add the scanned amount into the department