473,387 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VBA RTE 424; Object Required

Hello,
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
  1. Option Compare Database
  2.  
  3. Private Sub txtScanned_Input_AfterUpdate()
  4. Dim strInput As String
  5. strInput = txtScanned_Input
  6.  
  7.  
  8.   Me.lblMessage.Caption = "WAITING ON ENGRAVER"   'Changes Display Message
  9.  
  10.  
  11.  
  12.         DoCmd.RunSQL "INSERT INTO tblDOT_PEEN ([2D_DATA], [SCAN_DATE])" & _
  13.         "VALUES (txtScanned_Input, DATE());"                                   'Stores barcode data and scan date
  14.  
  15.  
  16.  
  17.  
  18.         MSComm0.CommPort = 1                      'Sets communication port to serial port Com1 - Dot Peen
  19.         MSComm0.Settings = "19200,N,8,1,N"             'Declares Dot-Peen settings
  20.         MSComm0.PortOpen = True                         'Opens port for read/write capability
  21.         MSComm0.Output = strInput                       'Initiates marking sequence of 2D barcode
  22.         MSComm0.PortOpen = False
  23.  
  24.     lblMessage.Caption = "CHECKING MARK"
  25.  
  26. '''''''''''''''
  27.     cmdWAIT
  28. '''''''''''''''
  29.  
  30.         MSComm1.CommPort = 2                            'Sets communication port to serial com2 - Congnex imager
  31.         MSComm1.PortOpen = True                         'Opens port for read capability
  32.         MSComm1.Input = strInput                        'Passes scanned data to imager
  33.  
  34.  
  35.             If MSComm1.Input = MSComm0.Output Then
  36.                 Me.lblMessage.Caption = "GOOD MARK!"
  37.             Else
  38.                MsgBox "Bad Mark! Please contact your manager", vbOKCancel, "Marking Error"
  39.             End If
  40.  
  41. ''''''''''''''
  42.     cmdRESET
  43. ''''''''''''''
  44.  
  45.  
  46. End Sub
  47.  
  48. Public Sub cmdWAIT()
  49.  
  50. Dim PauseTime, Start, Finish, TotalTime
  51.  
  52.     PauseTime = 2   ' Set duration.
  53.     Start = Timer    ' Set start time.
  54.     Do While Timer < Start + PauseTime
  55.         DoEvents    ' Yield to other processes.
  56.     Loop
  57.  
  58. End Sub
  59.  
  60. Public Sub cmdRESET()
  61.  
  62. strInput = ""
  63. strDP_Result = ""
  64. lblMessage.Caption = "LOAD BODY AND SCAN CORE BARCODE"
  65.  
  66.  
  67. End Sub
  68.  
  69.  
  70. End Sub
  71.  


Any help, tips, links, or info would be greatly appreciated.
Thanks in advance!
Nov 1 '07 #1
3 5438
Killer42
8,435 Expert 8TB
So, do you have an object named MSComm0 or not? It looks as though you probably should have an MSComm control on the form with this name.
Nov 2 '07 #2
I was assuming that MSComm was inherent to VBA. It specifically says "Object required", so that would make sense.

How would I go about putting something such as this on a form? MSComm is the way to open the serial port for communcation between devices. It's not like a textbox or button. Maybe I'm a little confused.


What would I need to do to put this onto the form?
Also, could I put this part of the code in it's own sub Method and call it and not receive the object required error?
Nov 2 '07 #3
debasisdas
8,127 Expert 4TB
select tools ---> activex control

and select the desired item form the list.
Nov 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
All parts of this application is written in VB 6.0. I have a dll on the server registered through COM+ and have exported it to a msi that's been installed on the workstation. Some of the time,...
1
by: mpmason14 | last post by:
i am trying to get the NotInList function working properly in MSAccess. my scenario is that i am trying to get it to add names to a combo list box if they aren't already in there. i gets to the...
1
by: honchoyuk | last post by:
Dear all, I am new to VB6. I have write the following code Sub btn_click() on error goto errhandler debug.print error.count
1
by: astarti | last post by:
I am a newbie using VB. I am trying to send a number to the serial port using MSComm1 and 'error 424 object required' is appeared. What's wrong? Please help me ...
2
by: ryanwood17 | last post by:
In my database, I have a search form in which I am trying to allow users to double click on an entry in the search form which will open another form to allow for edits. I am getting a Run-time '424'...
1
by: manali1 | last post by:
I get a error Run time error 424 object required while writing a VBA script in MS access
1
by: Nilam2477 | last post by:
I'm invoking COM dll method from VB program. COM interface method takes one of the parameter as IUnknown as below HRESULT SetMethod( long samNumber, IUnknown* List); When i try to call this...
11
by: dougmeece | last post by:
Good Morning Experts, I spent all weekend working on this and got absolutely no where. I have a database with an input form that runs an append query to append to a table. Form Name: ...
6
by: jatin32 | last post by:
Hi, I have below code on Form_Load() , I get one time error when I open this form. 424 Object required, please help ASAP. Option Compare Database Private Sub Form_Load()
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.