Link to home
Start Free TrialLog in
Avatar of syedasimmeesaq
syedasimmeesaqFlag for United States of America

asked on

Code help for scanning.

Dears
This is what my code looks like

Private Sub cmdScan_Click()
 
  Dim objScan As ImgScan
  Set objScan = Me!ImgScan1.Object
  With objScan
    .DestImageControl = "ImgEdit1"  'Tell it which image to control
    .FileType = BMP_Bitmap 'Tell it what file type to use
    .ScanTo = DisplayAndFile 'Scan to the screen and the file
    .Image = "C:\Documents and Settings\Asim\My Documents\My Pictures\acdp3.gif" 'Give a temporary file name
    .StartScan 'Open the twain scanner screen
  End With

End Sub

Private Sub ImgScan1_ScanDone()
'This event process after the scan is completed
 
  Dim objScan As ImgScan
  Set objScan = Me!ImgScan1.Object
  With objScan
    .CloseScanner
  End With
 
  With Me!OLEPicture
    .OLETypeAllowed = acOLEEmbedded 'Allow embedded OLE types
    .Class = "Paint.Picture" 'Insert the type of picture you want
    .SourceDoc = "C:\My Documents\TempImg.bmp" 'Tell the OLE control which picture to use
    .Action = acOLECreateEmbed 'Store the image in the database
  End With

'Delete the temporary file
  Kill "C:\My Documents\TempImg.bmp"
End Sub


I have used the chestysoft active-x. But when I run this code it gives me errors

I need help immediately as I have to put this proposal to work soon.

Thank You
Asim
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

What is the exact error you are getting?
On what line does it occur?
Avatar of syedasimmeesaq

ASKER

It says

Compile error
User-defined type not defined.

Its in a windows warrning box, after I click the command button.

Thanks
It also highlights thius section of the code

Private Sub cmdScan_Click()
 
  Dim objScan As ImgScan
Sounds like you ar missing the Reference to "ImgScan"


From Microsoft Knowledgebase:
You are referring to an object in an object library that you do not have referenced.

You must add a reference to the object library that contains the object that you are using in code. To do so, follow these steps:
1. Open any module in the database that is generating the error described in the "Symptoms" section of this article.  
2. On the Debug menu, click Compile All Modules. Note the line of code that is highlighted when you receive the error message.  
3. On the Tools menu, click References.  
4. Click to select the object library that contains the object referenced by the line of code that is highlighted.

Here is the Microsoft link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;182342

Let me know if this helps

I am trying it now. I will update you. Thanks
Nope ..there is nothing to add. Everything that I think was necessary is already there.
I checked all the available reference and still the same thing .
All I need is to be able to use my scanner and scan the pictures of the employees with their information like phone number and stuff but as time is passing by I think I wouldn't get any help to do that.
Here are two links to investigate

The first is a simple way to get the image into the database
Thes second appears to be the same code you have posted here

See if the first way might be simpler.
Re-read the second in case you just copied the code and did not see the full text.

https://www.experts-exchange.com/questions/10067440/Scaning-directly-into-an-access-record.html?query=scanner&topics=39
https://www.experts-exchange.com/questions/10303255/scanning-pictures.html?query=scanner&topics=39

That's all I can suggest

Good luck
First, add a reference to csXImageTrial Library (that's the ocx file).

Then dim like this:

  Dim csx As csXImageTrial.ImageBox

Also, download and play with the Access Demo file. This shows the traditional method of adding the control to the form and then refer to that control.

/gustav
I don't know what I did... Can you tell me step by step process
Thanks
Please help . This is really urgent
But did you get the demo file? It works.
It's much easier to study that.

/gustav
Which demo file ...I tried looking for it..didn't find it
ok can we do this way
Lets say that I have employee name and address, and when I go to his record it just pulls up his picture. But it should be so easy that the lady who is using the computer(really a little knowledge of computers) can update the new employees pictures? Do you guys think would it be simple to do and get it going by this weekend???
I appreciate any comments
Thank You
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial