473,837 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two saved image files to BLOB (BLOB to current record, not next record)?

4 New Member
Hi,

Hope you can assist...

My table has two OLE/BLOB fields. 1 x OLE (Photo) and 1 x OLE (Signature).

1. With WebCam, I save my image - "Works Fine":

Private Sub Capture_Click()
ezVidCap1.SaveD IB "C:\VisitorPhot o.jpg"
DoCmd.Close
DoCmd.OpenForm "frmImageBLOBDa taEntry", , , , acFormAdd
End Sub

1.1 I the use the following code for FileToBLOB (WebCam Image) - "Works Fine":

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Cli ck
Dim vntRetVar As Variant
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordse t("tblImageBLOB s")
If Validate Then
vntRetVar = ReadBLOB(Me![imgTheImage].Picture, rs, "ImageItem" )
If vntRetVar <= 0 Then GoTo SpecialError
rs.MoveLast
rs.Edit
rs("visFirstNam e") = Me![visFirstName]
rs("visSurname" ) = Me![visSurname]
rs("ImageFileEx tension") = Right(Me![imgTheImage].Picture, 3)
rs.Update
On Error Resume Next
DoCmd.Echo False
Forms![frmImageBLOBSum maryList].Requery
DoCmd.Echo True
DoCmd.Close acForm, Me.Name
DoCmd.GoToRecor d , , acLast
End If
Exit_cmdSave_Cl ick:
On Error Resume Next
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_cmdSave_Cli ck:
MsgBox "Err: " & Err.Number & " : " & Err.Description & " in Sub cmdSave_Click", vbCritical, "Protocol Validation Error"
Resume Exit_cmdSave_Cl ick
SpecialError:
MsgBox "Error " & -vntRetVar & " trying to write the BLOB", vbCritical, "Protocol Validation Error"
Resume Exit_cmdSave_Cl ick
End Sub

2. With Graphics Tablet, I save my signature - "Works Fine":

Dim objInk As MSINKAUTLib.Ink Picture
Dim bytArr() As Byte
Dim File1 As String
File1 = "C:\VisitorSign ature.jpg"
Set objInk = Me.InkPicture1. Object
If objInk.Ink.Stro kes.Count > 0 Then
bytArr = objInk.Ink.Save (2)
Open File1 For Binary As #1
Put #1, , bytArr
Close #1
End If
DoCmd.Close
DoCmd.OpenForm "frmImageBLOBDa taEntryVis", , , , acFormAdd
End Sub

2.1 Here is my question/problem!?! The code above (1.1) BLOBs my image. I need to do the same with the signature but it keeps adding the signature to the "next record" and not the "current record". I know the code below is incorrect but I have no clue how to correct it. Here is what I have - "Disaster":

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Cli ck
Dim vntRetVar As Variant
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordse t("tblImageBLOB s")
If Validate Then
vntRetVar = ReadBLOB(Me![imgTheImage].Picture, rs, "visSignatu re")
If vntRetVar <= 0 Then GoTo SpecialError
rs.MoveLast
rs.Edit
rs("visFirstNam e") = Me![visFirstName]
rs("visSurname" ) = Me![visSurname]
rs("ImageFileEx tensionVis") = Right(Me![imgTheImage].Picture, 3)
rs.Update
On Error Resume Next
DoCmd.Echo False
Forms![frmImageBLOBSum maryList].Requery
DoCmd.Echo True
DoCmd.Close acForm, Me.Name
DoCmd.GoToRecor d , , acLast
End If
Exit_cmdSave_Cl ick:
On Error Resume Next
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_cmdSave_Cli ck:
MsgBox "Err: " & Err.Number & " : " & Err.Description & " in Sub cmdSave_Click", vbCritical, "Protocol Validation Error"
Resume Exit_cmdSave_Cl ick
SpecialError:
MsgBox "Error " & -vntRetVar & " trying to write the BLOB", vbCritical, "Protocol Validation Error"
Resume Exit_cmdSave_Cl ick
End Sub

Any assistance appreciated...
Sep 13 '10 #1
1 1807
Shane van Heerden
4 New Member
Hi All,

Concerning my earlier post (Point 2.1)...

I have realised that my basBLOB is the problem and not cmdSave_Click() !?!

I need to BLOB three(3) fields in same record (T.Edit). Then, move to T.AddNew?

Any help is apprecited :o)

My code:
Function ReadBLOB(Source As String, T As Recordset, sField As String)

Dim NumBlocks As Integer, SourceFile As Integer, i As Integer
Dim FileLength As Long, LeftOver As Long
Dim FileData As String
Dim RetVal As Variant

SourceFile = FreeFile
Open Source For Binary Access Read As SourceFile
FileLength = LOF(SourceFile)

If FileLength = 0 Then
ReadBLOB = 0
Exit Function
End If

NumBlocks = FileLength \ BlockSize
LeftOver = FileLength Mod BlockSize

RetVal = SysCmd(acSysCmd InitMeter, "Reading BLOB", FileLength \ 1000)

If IsNull([Forms]![frmImageBLOBSum maryList]![ImageItem]) _
Or IsNull([Forms]![frmImageBLOBSum maryList]![visSignature]) _
Or IsNull([Forms]![frmImageBLOBSum maryList]![escSignature]) Then
T.Edit
Else
If Not IsNull([Forms]![frmImageBLOBSum maryList]![ImageItem]) _
Or Not IsNull([Forms]![frmImageBLOBSum maryList]![visSignature]) _
Or Not IsNull([Forms]![frmImageBLOBSum maryList]![escSignature]) Then
T.AddNew
End If
End If


FileData = String$(LeftOve r, 32)
Get SourceFile, , FileData
T(sField).Appen dChunk (FileData)

RetVal = SysCmd(acSysCmd UpdateMeter, LeftOver / 1000)

FileData = String$(BlockSi ze, 32)
For i = 1 To NumBlocks
Get SourceFile, , FileData
T(sField).Appen dChunk (FileData)

RetVal = SysCmd(acSysCmd UpdateMeter, BlockSize * i / 1000)

Next i
T.Update

RetVal = SysCmd(acSysCmd RemoveMeter)

Close SourceFile
ReadBLOB = FileLength
Exit Function

Err_ReadBLOB:
ReadBLOB = -Err
MsgBox "ReadBLOB Error " & Err & " : " & Error$
Exit Function

End Function
Sep 15 '10 #2

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

Similar topics

3
2212
by: Warmonkey | last post by:
Hi there, I have been frustrated by the 'next record' problem when a user tabs off the last control on a form. I have tried a couple of the suggestions listed on the newsgroup, but so far nothing has solved the problem in relation to my database. I have 3 subforms on the form and serveral other controls (such as buttons). When the final subform receives focus (a one-to-many style
2
1750
by: Doslil | last post by:
hi, I have a drop down list on the main form which has a query attached to it.Looks like the record is not moving to the next record,cos when I select the next record from the list it gives an error message "the record could not saved ,it could create a duplicate values in the index,primary key or relationship............".I am also getting this message when I click on the record selectors. Can anyone please give me any tips
1
2707
by: Veetold | last post by:
The solution you suggested works very good - thanks again. I encountered a new problem related to this topic. According to your advise I put the following line to print and format event: Me.BookCover.Picture = IIf(Me.IsCover= true, Me.BookCoverPath, "") to avoid problems when the file specified in field does not exist I add a logical field to source table: indicating physical presence of the file. Surprisingly when there is no file ...
15
11269
by: Susan Bricker | last post by:
Greetings. I have a Mainform with a subform. The Mainform has single record format and subform has continuous form format. When the Mainform opens, I force allowadditions and allowedits to FALSE (for both the Mainform and Subform). No problem there. However, when I click on the navigation control of the subform to move to the next record in the subform, the AllowAdditions and AllowEdits changes to TRUE. Not good. I set...
7
2409
by: todholt | last post by:
Hello, I am trying to bypass a form's automatic update, and instead call a stored procedure in sql server. I am using continuous forms. The problem I am having is with returning to the next selected record once I have performed the update. i.e. user edits record A and then clicks on record B. Record A is updated, and selection moves to record B. I don't know how to determine what record B is...
5
3043
by: Sam | last post by:
I have some required fields on a form. I'm checking these fields in the Form_BeforeUpdate sub. When just clicking on the fields and then trying to go to the next record by clicking on the little arrow at the bottom of the form it works as intended (A message box pops up telling the user the field is required and sets focus to the next field in my If Else statement), but when I tab into the field (any field) the message box pops up...
1
2001
by: phpmaet | last post by:
Hi I have viewed the record from mysql table. But I need to retrieve the next record id while reading the each an every record. Could someone explain how I retrieve the next record id in a table(Note. WHILE READING THE CURRENT RECORD)? Thanks
6
5345
by: AppDev63 | last post by:
I've been struggling with a form. On the left side of the form I've got data from a table of invoices, and on the right side I've got a combo box with data from a table of payments. The user scrolls through the invoices on the left and matches each one up with a payment from the combo box on the right. The common field is an order number, but the relationship between invoices and payments must be created manually by the user matching up the...
1
1810
by: cbanks | last post by:
Hello Ladies/Gents, im in need of some serious help here.. I have a tool that allows users to view information on a form and make changes to recordsets. This tool has buttons that allow a user to cruise to the next or previous record. The problem i am having is when they click next record it moves to the next record and checks to see if the record is stamped as open. If it is stamped as open, meaning opened by another user, then it will...
7
10313
by: shalskedar | last post by:
In a query i want to retrieve the value in such a way that if the value for the current record for a given column is 0 then it should go to the next record & take the value. for ex-I 've column Payment received in the query.I want to retrieve the value in such a way that if the current record value for this column is 0 then it should go to the next record value..
0
9693
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10897
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10583
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7823
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7009
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
4056
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3128
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.