473,378 Members | 1,420 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,378 software developers and data experts.

Need Help to Create Object

Access 2000

I have a check scanner from Magtek, (MicrImage) This is like a "point
of sale" check scanner/credit card reader. Magtek furnished 2 ocx's
(MTMicrImage.ocx & SaxComm8.ocx). They also give example VB code.

I need to make this work in Access. I know the following code will
require a lot of modification for VBA.

My Problem is getting started - I have copied the ocx's to the
system32 folder and registered them. I also have a reference to them
in Access.

How do I create the "Object" so I can use the methods of the ocx?

Here is the VB code Example -

************************************************** ************

Private Sub LogStatus(ByVal InfoToLog As String)

txtStatus.Text = txtStatus.Text & InfoToLog & vbCrLf

txtStatus.SelLength = 0

txtStatus.SelStart = Len(txtStatus.Text)

End Sub


Private Sub cmdClear_Click()

txtStatus.Text = ""

txtMagStripeData.Text = ""

txtFirstName.Text = ""

txtLastName.Text = ""

txtMonth.Text = ""

txtYear.Text = ""

txtTrack1.Text = ""

txtTrack2.Text = ""

txtTrack3.Text = ""

txtAccountNum.Text = ""

txtMicrData.Text = ""

txtMicrAccountNum.Text = ""

txtCheckNum.Text = ""

txtTransit.Text = ""
txtFileName.Text = ""

txtIFD.Text = ""

txtTagNum.Text = ""

txtTagOutput.Text = ""

cmdGetTagByNum.Enabled = False

cmdGetAllTags.Enabled = False
End Sub


Private Sub cmdExit_Click()

Unload Me


End Sub


Private Sub cmdGetAllTags_Click()

Dim ReturnVal As Variant

Dim FieldCount As Integer

Dim i As Integer

Dim TagNum As Long


LogStatus "Getting All Tags in file " & txtFileName.Text & ": "

ReturnVal = MicrImage.EnumTiffTags(txtFileName.Text, txtIFD.Text)



If IsArray(ReturnVal) Then

FieldCount = UBound(ReturnVal)

LogStatus "There are " & FieldCount & " Tags"


For i = 1 To FieldCount

TagNum = MicrImage.GetTiffTagNumByIndex(txtFileName.Text, i,
txtIFD.Text)

LogStatus " Tag # " & TagNum & "= " &
MicrImage.GetTiffTagByNumber(txtFileName.Text, TagNum, txtIFD.Text)

Next

Else

LogStatus "There are No Tags in IFD " & txtIFD.Text & " in file " &
txtFileName.Text

End If


End Sub


Private Sub cmdGetTagByNum_Click()

LogStatus "Getting Tag By Tag Number:"

txtTagOutput.Text = MicrImage.GetTiffTagByNumber(txtFileName.Text,
txtTagNum.Text, txtIFD.Text)

End Sub


Private Sub cmdPortOpen_Click()


If Not (MicrImage.PortOpen) Then

MicrImage.CommPort = txtCommPort.Text

MicrImage.Settings = txtSettings.Text

End If

MicrImage.PortOpen = Not MicrImage.PortOpen


If MicrImage.PortOpen Then
LogStatus "Port Opened"

cmdPortOpen.Caption = "Close Port"

If MicrImage.DSRHolding Then

LogStatus "Device Attached"

'Displays Current Switch Settings

'If you use the MicrImage.Save command then these do not need to be
sent

'every time you open the device
MicrImage.MicrTimeOut = 1

LogStatus "These are the Current Switch Settings"

LogStatus " Switch A: " & MicrImage.MicrCommand("SWA", True)

LogStatus " Switch B: " & MicrImage.MicrCommand("SWB", True)

LogStatus " Switch C: " & MicrImage.MicrCommand("SWC", True)

LogStatus " Switch D: " & MicrImage.MicrCommand("SWD", True)

LogStatus " Switch E: " & MicrImage.MicrCommand("SWE", True)

LogStatus " Switch I: " & MicrImage.MicrCommand("SWI", True)

LogStatus " Switch HW: " & MicrImage.MicrCommand("HW", True)


'Sets Switch Settings

'If you use the MicrImage.Save command then these do not need to be
sent

'every time you open the device
MicrImage.MicrCommand "SWA 00100010", False

MicrImage.MicrCommand "SWB 00100010", False

MicrImage.MicrCommand "SWC 00100000", False

MicrImage.MicrCommand "HW 00111100", False

MicrImage.MicrCommand "SWE 00000010", False

MicrImage.MicrCommand "SWI 00000000", False

'MicrImage.Save

'Displays New Settings

'If you use the MicrImage.Save command then these do not need to be
sent

'every time you open the device

LogStatus "These are the New Switch Settings:"

LogStatus " Switch A: " & MicrImage.MicrCommand("SWA", True)

LogStatus " Switch B: " & MicrImage.MicrCommand("SWB", True)

LogStatus " Switch C: " & MicrImage.MicrCommand("SWC", True)

LogStatus " Switch D: " & MicrImage.MicrCommand("SWD", True)

LogStatus " Switch E: " & MicrImage.MicrCommand("SWE", True)

LogStatus " Switch I: " & MicrImage.MicrCommand("SWI", True)

LogStatus " Switch HW: " & MicrImage.MicrCommand("HW", True)
'The OCX will work with any Micr Format. You just need to know which

'format is being used to parse it using the FindElement Method

LogStatus "Changing Format to 6200 for this Demo"

MicrImage.FormatChange "6200"

LogStatus "Version: " & MicrImage.Version

MicrImage.MicrTimeOut = 2

Else

LogStatus "Device Not Attached"

End If

Else

LogStatus "Port Closed"

cmdPortOpen.Caption = "Open Port"

End If




End Sub


Private Sub Form_Load()

txtCommPort.Text = MicrImage.GetDefSetting("CommPort", "1")

txtSettings.Text = MicrImage.GetDefSetting("Settings", "115200,N,8,1")

lblCaption(0).Caption = App.ProductName

lblCaption(1).Caption = App.ProductName

End Sub


Private Sub MicrImage1_MicrDataReceived()

Dim ImagePath As String

Dim ImageFileName As String

Dim ImageIndex As String

Dim Status As Long

Dim StatusMsg As String

Dim bOpStatus As Boolean


If MicrImage.GetTrack(1) & MicrImage.GetTrack(2) &
MicrImage.GetTrack(3) <"" Then

LogStatus "Event Fired: MagStripe Data"

txtMagStripeData.Text = MicrImage.MicrData

txtFirstName.Text = MicrImage.GetFName()

txtLastName.Text = MicrImage.GetLName()

txtMonth.Text = MicrImage.FindElement(2, "=", 2, "2", False)

txtYear.Text = MicrImage.FindElement(2, "=", 0, "2", False)

txtTrack1.Text = MicrImage.GetTrack(1)

txtTrack2.Text = MicrImage.GetTrack(2)

txtTrack3.Text = MicrImage.GetTrack(3)

txtAccountNum.Text = MicrImage.FindElement(2, ";", 0, "=", False)

Else

LogStatus "Event Fired: Micr Data"

txtMicrData.Text = MicrImage.MicrData

txtMicrAccountNum.Text = MicrImage.FindElement(0, "TT", 0, "A", False)

txtCheckNum.Text = MicrImage.FindElement(0, "A", 0, "12", False)

txtTransit.Text = MicrImage.FindElement(0, "T", 0, "TT", False)


ImagePath = MicrImage.GetDefSetting("ImagePath", "C:\")


'This sets up and index number so that we can deal with same check
being

'inserted over and over. The TransmitCurrentImage Method with fail if
the file

'already exists. This is to ensure that no check image is overwritten.
By keeping

'an ImageIndex and incrementing it we ensure that the same file name
will not be

'generated below. You are free to name the file anything that is
considered to be

'a valid file name.

ImageIndex = MicrImage.GetDefSetting("ImageIndex", "0")
ImageIndex = CStr(CInt(ImageIndex) + 1)

MicrImage.SaveDefSetting "ImageIndex", ImageIndex

ImageFileName = ImagePath & "MI" & txtTransit.Text &
txtMicrAccountNum.Text & txtCheckNum.Text & ImageIndex & ".TIF"
LogStatus "Acquiring File: " & ImageFileName & " ..."
'Adding a tiff tag.

MicrImage.AddTag ("T32768=This was added by the Demo Program")
'Transmitting current image

Status = MicrImage.TransmitCurrentImage(ImageFileName, StatusMsg)
'Logging status of TransmitCurrentImage

LogStatus "TransmitCurrentImage: " & Status


If Status = "0" Then

bOpStatus = ShellEx(ImageFileName, , , , , Me.hWnd)

If bOpStatus = True Then

LogStatus "Shell Successful"
'setting up the Image Info

txtFileName.Text = ImageFileName

txtIFD.Text = "1"

txtTagNum.Text = "270"

cmdGetTagByNum.Enabled = True

cmdGetAllTags.Enabled = True

Else

LogStatus "Shell Failed"

cmdGetTagByNum.Enabled = False

cmdGetAllTags.Enabled = False

End If

End If

End If


MicrImage.ClearBuffer

End Sub


Private Sub mnuAbout_Click()

frmAbout.Show vbModal


End Sub


Private Sub mnuExit_Click()

Unload Me

End Sub

************************************************** ****

Thanks
Dale

Jun 27 '08 #1
0 1422

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jon wayne | last post by:
OK! I had this nagging doubt Consider (without worrying abt access specifiers) class Kid : public Parent{...}; Parent::someFunc() { Kid k; }
7
by: Jack Addington | last post by:
I've got a fairly simple application implementation that over time is going to get a lot bigger. I'm really trying to implement it in a way that will facilitate the growth. I am first writing a...
6
by: daveyand | last post by:
Hey Guys, I've stumped. I created a function that does various things to select boxes. Namely Get All selected indexes, populate array with these values
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
5
by: Paul M | last post by:
Hi I need to create a map for a room (chairs, bed, TV, forniture, etc). All object allready exists like png images. I need to create a map for each room, i mean the user need to create. How...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
15
by: Jess | last post by:
Hello, Sometimes declarations are all what we need when we define/declare classes (or functions?), but sometimes we need definitions. I learned that if we define a class (B) that has an object...
10
by: CuTe_Engineer | last post by:
hii, i have cs assignment i tried to solve it but i still have many errors , plzz help mee :"< it`s not cheating becuz i`ve tried & wrote the prog. i just wanna you to show me my mistakes ...
9
by: pereges | last post by:
Hello I need some ideas for designing a recursive function for my ray tracing program. The idea behind ray tracing is to follow the electromagnetic rays from the source, as they hit the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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...

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.