EID card reading code (1 Viewer)

Wim Dewilde

New member
Local time
Today, 07:46
Joined
Sep 10, 2014
Messages
2
Dear programmers,

I am relativly new to the world of acces, yes i have learned my way around.
I would also like to apologize if this is an issue already solved, but i think not. i searched and searched all over the net, yet i cannot find any answers.

I am currently breaking my head in order to do the following:
in Belgium, we all have readable id cards. (EID)
i need to integrate the card reader in my acces 2013 database.

i got 1 code that should work, but it doesnt when i try it.

Here are my sources:
links i cannot post because of the 10 post limit...

It is very frustrating getting it not to work but it should be possible because i know several VBA based programs that work find with the card reader.

any help would be welcome!

Wim Dewilde
 

Wim Dewilde

New member
Local time
Today, 07:46
Joined
Sep 10, 2014
Messages
2
this is the code (working) for excel:
Option Explicit

'---------------------------------------------------------------------------------------
' Procedure : TestEID
' Author : Charlizenne ... and the website with e-id info
' Date : 19/06/2010
' Purpose : read info from passport-chip with cardreader
' the e-id software needs to be installed because you need a reference
' to beidlibaxctrl 1.1 type
'---------------------------------------------------------------------------------------
'
Sub TestEID()
'
' TestEID Macro
'
' You need to make a reference to * beidlibaxctrl 1.1 type * library
' it's on your system if you install the e-id software
'
Dim EIDlib1 As New EIDLIBCTRLLib.EIDlib

Dim lhandle As Long

Dim RetStatus As New EIDLIBCTRLLib.RetStatus
Dim MapColPicture As New EIDLIBCTRLLib.MapCollection
Dim MapColID As New EIDLIBCTRLLib.MapCollection
Dim MapColAddress As New EIDLIBCTRLLib.MapCollection
Dim CertifCheck As New EIDLIBCTRLLib.CertifCheck

Dim strName As String
Dim strFirstName1 As String
Dim strBirthPlace As String
Dim strBirthDate As String
Dim strGender As String
Dim strNationality As String
Dim strNationalNumber As String

Dim strStreet As String
Dim strZipcode As String
Dim strMunicipality As String

'this one holds the picture data in byte format
Dim Pasfoto_Temp() As Byte
'this one is the path for saving the picture
Dim mypathfoto As String

mypathfoto = "c:\temp\"

Set RetStatus = EIDlib1.Init("", 0, 0, lhandle)
If lhandle = 0 Then
MsgBox "Please insert your id-card ...", vbOKOnly, "Reading id-card ..."
Set RetStatus = EIDlib1.Exit
Exit Sub
End If

Set RetStatus = EIDlib1.GetID(MapColID, CertifCheck)

strName = MapColID.GetValue("Name")
strFirstName1 = MapColID.GetValue("FirstName1")
strBirthDate = MapColID.GetValue("BirthDate")
strBirthPlace = MapColID.GetValue("BirthPlace")
strGender = MapColID.GetValue("Gender")
strNationality = MapColID.GetValue("Nationality")
strNationalNumber = MapColID.GetValue("NationalNumber")

Set RetStatus = EIDlib1.GetAddress(MapColAddress, CertifCheck)

strStreet = MapColAddress.GetValue("Street")
strZipcode = MapColAddress.GetValue("ZIPCode")
strMunicipality = MapColAddress.GetValue("Municipality")

Set RetStatus = EIDlib1.GetPicture(MapColPicture, CertifCheck)

Pasfoto_Temp = MapColPicture.GetValue("Picture")

'here we pass the array of the picture to the function PictureFromRes
'and save it on the hard drive with the nationalnumber as filename
'I suppose this one is unique for everyone

SavePicture PictureFromRes(Pasfoto_Temp), mypathfoto & strNationalNumber & ".jpg"

Set RetStatus = EIDlib1.Exit

With ActiveWorkbook.ActiveSheet
.Cells(1, 2).Value = strName
.Cells(2, 2).Value = strFirstName1
.Cells(3, 2).Value = strBirthDate
.Cells(4, 2).Value = strBirthPlace
.Cells(5, 2).Value = strGender
.Cells(6, 2).Value = strNationality
.Cells(7, 2).Value = strNationalNumber
.Cells(8, 2).Value = strStreet
.Cells(9, 2).Value = strZipcode
.Cells(10, 2).Value = strMunicipality
.Cells(1, 3).Select
.Pictures.Insert mypathfoto & strNationalNumber & ".jpg"
.Cells(1, 1).Select
End With
End Sub

this is supposebly the code for VBA acces:
Sub TestEID()
'
' TestEID Macro
'
'
Dim EIDlib1 As New EIDLIBCTRLLib.EIDlib

Dim lhandle As Long

Dim RetStatus As New EIDLIBCTRLLib.RetStatus
Dim MapColPicture As New EIDLIBCTRLLib.MapCollection
Dim MapColID As New EIDLIBCTRLLib.MapCollection
Dim MapColAddress As New EIDLIBCTRLLib.MapCollection
Dim CertifCheck As New EIDLIBCTRLLib.CertifCheck

Dim strName As String
Dim strFirstName1 As String
Dim strBirthPlace As String
Dim strBirthDate As String
Dim strGender As String
Dim strNationality As String
Dim strNationalNumber As String

Dim strStreet As String
Dim strZipcode As String
Dim strMunicipality As String

Dim Pasfoto_Temp As Variant

Set RetStatus = EIDlib1.Init("", 0, 0, lhandle)

Set RetStatus = EIDlib1.GetID(MapColID, CertifCheck)

strName = MapColID.GetValue("Name")
strFirstName1 = MapColID.GetValue("FirstName1")
strBirthDate = MapColID.GetValue("BirthDate")
strBirthPlace = MapColID.GetValue("BirthPlace")
strGender = MapColID.GetValue("Gender")
strNationality = MapColID.GetValue("Nationality")
strNationalNumber = MapColID.GetValue("NationalNumber")

Set RetStatus = EIDlib1.GetAddress(MapColAddress, CertifCheck)

strStreet = MapColAddress.GetValue("Street")
strZipcode = MapColAddress.GetValue("ZIPCode")
strMunicipality = MapColAddress.GetValue("Municipality")

Set RetStatus = EIDlib1.GetPicture(MapColPicture, CertifCheck)
Pasfoto_Temp = MapColPicture.GetValue("Picture")

Set RetStatus = EIDlib1.Exit

MsgBox strName & ", " & strFirstName1 & vbCrLf & _
strStreet & vbCrLf & _
strZipcode & " " & strMunicipality & vbCrLf,
vbOKOnly
End Sub
 

Users who are viewing this thread

Top Bottom