as a part of a little VBA module on form, I need to be able to somehow read/get/return the current record number, the same record number which data is shown on the form, and put it in a variable.
There was a similar code in here. Anyway i adapted that into mine. Hope this can help.
in the OnCurrent event
Me.RecordsetClone.Bookmark = Me.Bookmark
CurrRec.Value = Me.RecordsetClone.AbsolutePosition + 1
'to get current record no
AllRec.Value = Me.Recordset.Clone.RecordCount
'to get last record no
To ensure that the current record is displayed once the page is opened.
in the OnLoad event
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
'to ensure that the record no is updated
I have a form, same as above, where I have two check boxes, that tell if a face and/or a full picture (standard named) is available for a person. If it is I try and show the picture in an unbound box, but I get two different errors, on different occasions.
Error #1
"Microsoft Visual Basic
Run-time error '2753'
A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control"
I keep getting this error, even when I click my command button, see code below.
Private Sub Form_Current()
UpdatePictures
End Sub
Public Sub UpdatePictures()
bitFullPicture_Name_Click
bitFacialPicture_Name_Click
End Sub
Private Sub bitFacialPicture_Name_Click()
If bitFacialPicture = True Then
oleFacialPicture.SourceDoc = "C:\Face\PopularName.jpg"
oleFacialPicture.Action = acOLECreateLink
Else
oleFacialPicture = Null
End If
End Sub
Private Sub bitFullPicture_Name_Click()
If bitFullPicture = True Then
oleFullPicture.SourceDoc = "C:\Full\PopularName.jpg"
oleFullPicture.Action = acOLECreateLink
Else
oleFullPicture = Null
End If
End Sub"
The variable "bitFacialPicture" and "bitFullPicture" is a Yes/No field/checkbox. The filename is actually generated from a name field on the form. When checked the picture is supposed to be shown and I use the "oleFacialPicture = Null" if it's not set, to erase the picture from the unbound field as it does not clear by it self.
Error #2 I'm getting, sometimes it works for a while and then if I click my above posted command button with code twice on the same record I get this error:
"Run-time error '2719':
A problem occured while accessing the OLE object"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.