I'm receiving a "424 Run time error: Object required" in the simple program that I've created in Access 2K3 SP2. The program is in a manufacturing environment. Here's an overview of the process: an operator will scan a 2D barcode, that input triggers an engraver to engrave the input onto metal. Then a verification camera takes a picture and verifies the mark to the original data.
I get the error code on the first line when trying to communicate with port COM1. The error line is in bold and if I comment our that line, it just gives the error on the next line and so on....
It seems as though VB thinks that "MSComm0" is a variable.
And as usual, the Microsoft help doesn't do much for me.
Here's the code:
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Private Sub txtScanned_Input_AfterUpdate()
- Dim strInput As String
- strInput = txtScanned_Input
- Me.lblMessage.Caption = "WAITING ON ENGRAVER" 'Changes Display Message
- DoCmd.RunSQL "INSERT INTO tblDOT_PEEN ([2D_DATA], [SCAN_DATE])" & _
- "VALUES (txtScanned_Input, DATE());" 'Stores barcode data and scan date
- MSComm0.CommPort = 1 'Sets communication port to serial port Com1 - Dot Peen
- MSComm0.Settings = "19200,N,8,1,N" 'Declares Dot-Peen settings
- MSComm0.PortOpen = True 'Opens port for read/write capability
- MSComm0.Output = strInput 'Initiates marking sequence of 2D barcode
- MSComm0.PortOpen = False
- lblMessage.Caption = "CHECKING MARK"
- '''''''''''''''
- cmdWAIT
- '''''''''''''''
- MSComm1.CommPort = 2 'Sets communication port to serial com2 - Congnex imager
- MSComm1.PortOpen = True 'Opens port for read capability
- MSComm1.Input = strInput 'Passes scanned data to imager
- If MSComm1.Input = MSComm0.Output Then
- Me.lblMessage.Caption = "GOOD MARK!"
- Else
- MsgBox "Bad Mark! Please contact your manager", vbOKCancel, "Marking Error"
- End If
- ''''''''''''''
- cmdRESET
- ''''''''''''''
- End Sub
- Public Sub cmdWAIT()
- Dim PauseTime, Start, Finish, TotalTime
- PauseTime = 2 ' Set duration.
- Start = Timer ' Set start time.
- Do While Timer < Start + PauseTime
- DoEvents ' Yield to other processes.
- Loop
- End Sub
- Public Sub cmdRESET()
- strInput = ""
- strDP_Result = ""
- lblMessage.Caption = "LOAD BODY AND SCAN CORE BARCODE"
- End Sub
- End Sub
Any help, tips, links, or info would be greatly appreciated.
Thanks in advance!