Losing focus on the records of a Subform because of a web search control

Marco Soares

Registered User.
Local time
Today, 15:38
Joined
Dec 27, 2015
Messages
10
Hello

I created a database in Microsoft Access. In the main form, I inserted a subform in which the records are shown as datasheet. Bellow this subform, I inserted a Web Browser Control. For each record in the subform, a different PDF (or a different section of a PDF) is shown in the Web Browser Control. Access is using Adobe Reader to open the PDFs in this control.

The problem is that, when i move to the next record in the subform (and it’s corresponding PDF opens in the web browser control), the arrows of the keyboard stop having effect on the records of the subform. In order to move to next record, i have to click on it with the mouse.

In this situation, when I scroll down the records of the subform, I have to click on each record. Of course, this is a very bad solution. Please I need to know what can I do to be able to scroll down the records with the up and down arrows of the keyboard.

Thank you very much in advance!

Regards,
Marco
 
how do you show the pdf in the web control? do you use the subform's current event, ie:

private sub form_current()
me.parent!webrowser1.navigate me.yourPDFField & ""
end sub
 
Thank you very much for the fast reply!

I didn't really write any code. I just added a line to the "Control Source" in the "Property Sheet" of the Web Search Control. The line was this:

=[Query1 subform2].[Form]![Link] & "#NamedDest=" & [Query1 subform2].
[Form]![Dest] & "&zoom=" & [Query1 subform2].[Form]![Zoom]

It opens the PDF with a specific zoom and in a specific named destination.
 
why dont you try doing it in your subforms current event then:
Code:
Private Sub Form_Current()
    Me.Parent!WebBrowser1.Object.ExecWB OLECMDID_OPTICAL_ZOOM, _
        OLECMDEXECOPT_DONTPROMPTUSER, CLng(Me!Zoom), vbNull
    
    Me.Parent!WebBrowser1.Object.Navigate Me!Dest & ""

End Sub
 
I put the code below in the "On Current". When i run the Form it says: "Compile Error: Method or data member not found", highlighting "!Zoom" in the code. There is a screen picture of the error attached to this reply.

Code:
Private Sub Form_Current()

Me.Form1!WebBrowser57.Object.ExecWB OLECMDID_OPTICAL_ZOOM, _
OLECMDEXECOPT_DONTPROMPTUSER, CLng(Me!Zoom), vbNull

Me.Form1!WebBrowser57.Object.Navigate Me!Dest & ""

End Sub

Thank you very much for the atention!
 

Attachments

  • Compile Error.jpg
    Compile Error.jpg
    98.8 KB · Views: 84
try Clng(Me![Zoom]).

you have field [Zoom] in your subform, it was in your orig code.
 
Complement to my last post:

Name of my main form: Form1
Name of the subform: Query1 subform2
Name of the Web Browser Control: WebBrowser57
In the subform, the fields that have the named destination and zoom are "Dest" and "Zoom".

I just noticed you replied to my last post. I will read your reply now, just after i post this text.

Thank you in advance
 
Yes, i have a field called "Zoom" in my subform. I think there must be a different way to refer to this field of this subform, but i don't know why.
 
Attached to this reply is a very reduced version of my Database. The original one has more Queries, Forms and Data. In this "very reduced" one, i included just some "fake useless data" and just the minimum set of Queries and Forms to let you see the problem. Please, fill the "Link" field of some records with links to PDFs in your computer. Then try to move through the records using the keyboard up and down keys.

In this "reduced version", i think that the Database puts the focus in a specific control of the main form when the Web Browser Control shows a new PDF. In the "Real Database", it's not clear where the Focus is after a new PDF is shown. It seems to be nowhere... Anyway, i think it doesn't matter. If someone can show me how to solve the problem in this "Very Reduced Version", i can correct the "Real Database" too.

If it's possible, please try to write some code to solve the problem, post it back and let me know what you did.
Thank you very very much in advance for all the atention and for willing to help!

Best Regards,
Marco
 

Attachments

Users who are viewing this thread

Back
Top Bottom