473,241 Members | 1,555 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,241 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 1415

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...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.