I am currently working on a senior project for school.
I am using an rfid reader that will read tags and display the tag number in ms access.
I want to link the individual tags to a person that I will just make up so when a tag is read it will display that person's info.
The code is below that came with the reader.
Code:
Option Compare Database
Private WithEvents PM As PHIDGET.PhidgetManager
Dim WithEvents RF As PHIDGET.PhidgetRFID
Dim strLastTag As String
Private Sub Form_Load()
Set PM = New PHIDGET.PhidgetManager
Call But_ClearTable_Click
'Use the following code to attach reader directly without using the PhidgetManager
'Set RF = New PHIDGET.PhidgetRFID
'Call RF.Open(False)
End Sub
'When the reader appears, assign the events to RF
Private Sub PM_OnAttach(ByVal PHIDGET As IPhidget)
If PHIDGET.DeviceType = "PhidgetRFID" Then
Set RF = PHIDGET
lblAttached.Caption = "PhidgetRFID" & " Version " & RF.DeviceVersion & ", Serial# " & RF.SerialNumber
'Check the form to determine if the Reader has been enabled and set it on the device
If chkDigitalOutput3 Then RF.OutputState(3) = True Else RF.OutputState(3) = False
End If
End Sub
Private Sub chkDigitalOutput0_Click()
If chkDigitalOutput0 Then RF.OutputState(0) = True Else RF.OutputState(0) = False
End Sub
Private Sub chkDigitalOutput1_Click()
If chkDigitalOutput1 Then RF.OutputState(1) = True Else RF.OutputState(1) = False
End Sub
Private Sub chkDigitalOutput2_Click()
If chkDigitalOutput2 Then RF.OutputState(2) = True Else RF.OutputState(2) = False
End Sub
Private Sub chkDigitalOutput3_Click()
If chkDigitalOutput3 Then RF.OutputState(3) = True Else RF.OutputState(3) = False
End Sub
'When the event OnTag is thrown by the PhidgetRFID Reader
Private Sub RF_OnTag(ByVal TagNumber As String)
'If the TagNumber is the same as the last tag then ignore it
If chkOnlySingleEntries Then
If TagNumber = strLastTag Then Exit Sub
End If
Me.[TblTagIDs subform].Form.Recordset.AddNew
Me.[TblTagIDs subform].Form.Recordset!tagid = TagNumber
Me.[TblTagIDs subform].Form.Recordset.Update
strLastTag = TagNumber
End Sub
'Delete all lines from the table TblTagIDs
Private Sub But_ClearTable_Click()
CurrentDb.Execute "DELETE FROM TblTagIDs;"
Me.TblTagIDs_subform.Requery
End Sub
'When the reader disappears, say so
Private Sub PM_OnDetach(ByVal PHIDGET As PHIDGET.IPhidget)
If PHIDGET.DeviceType = "PhidgetRFID" Then
lblAttached.Caption = "Attach an RFID tag reader"
Set RF = Nothing
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call But_ClearTable_Click
End Sub
any suggestions.
thanks pete