PDA

Vollständige Version anzeigen : Problem: Ereignisprozedur verändert Inhalt aller Webbrowser


c.kusche
28.04.2011, 09:53
Hallo @ all,

ich habe ein Problem mit meinen Webbrowser. Ich habe ein Formular, in dem ich 2 Webbrowser eingefügt habe, die Werte anzeigen sollen. Der erste WB zeigt meine offenen Aufträge an wie folgt:

Public Sub makeHTML_auftrag_liste()

Dim sprache, store_id_1
sprache = Forms!hauptformular.Controls!sprache_id
store_id_1 = Forms!hauptformular.Controls!store_id


Dim Starturl As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT sales_flat_order.entity_id AS ctl_wert_1, label_varchar!labelname & "": "" & sales_flat_order!increment_id AS ctl_anzeige1," & _
"IIf(IsNull(sales_flat_order_address!company)=True,sales_flat_order_address!lastn ame " & _
"& "", "" & sales_flat_order_address!firstname,sales_flat_order_address!company) AS ctl_anzeige, boxen_varchar.titel " & _
"FROM label_varchar, boxen_varchar, sales_flat_order INNER JOIN sales_flat_order_address " & _
"ON sales_flat_order.entity_id = sales_flat_order_address.parent_id " & _
"WHERE (((sales_flat_order.State) = """ & "new" & """) And ((sales_flat_order.status) = """ & "pending" & """) And ((label_varchar.label_id) = 14) And ((label_varchar.language_id) = " & sprache & ") " & _
"And ((sales_flat_order_address.address_type) = """ & "billing" & """) And ((boxen_varchar.boxen_id) = 5) And ((sales_flat_order.store_id) = " & store_id_1 & ") And ((boxen_varchar.language_id) = " & sprache & ")) " & _
"ORDER BY sales_flat_order.entity_id DESC", dbOpenDynaset)

Starturl = "file:///" & Replace(CurrentProject.Path, "\", "/") & "/" & "index.html"

Open CurrentProject.Path & "\index.html" For Output As #1
Print #1, "<!DOCTYPE HTML PUBLIC " & Chr(34) & "-//W3C//DTD HTML 4.0 Transitional//EN" & Chr(34) & ">"
Print #1, "<!-- saved from url=(0013)about:internet -->"
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<link rel=""stylesheet"" type=""text/css"" href=""../css/styles.css"" />"
Print #1, "</head>"
Print #1, "<body>"
Print #1, "<div id = ""nav"" >"
Print #1, "<h3>Lieferanten</h3>"
' Print #1, "<table border=" & Chr(34) & "0" & Chr(34) & ">"
Do Until rs.EOF
Print #1, "<li><a href=" & Chr(34) & "index.html?ctl_wert_1=" & rs!ctl_wert_1 & Chr(34) & ">" & rs!ctl_anzeige1 & "<br>" & rs!ctl_anzeige & "</a></li>"
rs.MoveNext
Loop
Print #1, "</div>"
Print #1, "<a href=" & Chr(34) & "index.html?id=" & 99999 & Chr(34) & ">abbrechen</a>"
Print #1, "</body>"
Print #1, "</html>"
Close #1

DoEvents
Forms!hauptformular.Controls!WebBrowser1.Navigate Starturl
Forms!hauptformular.Controls!URL = Starturl
rs.Close
Set rs = Nothing
Set db = Nothing
' Forms!hauptformular.Controls!WebBrowser0.Object.Navigate2 "http://www.clarin-chemie.com/index.php/admin/sales_order/index/key/"
Forms!hauptformular.Controls!WebBrowser1.Visible = True

End Sub

Das funktioniert auch!

Dann führe ich eine "WebBrowser1_BeforeNavigate2" Funktion aus. Diese zeigt mir meine resultierende Website an, indem es die ID meines Auftrags ermittelt.

Diese ID Nutze ich jetzt, um in meinem zweiten WB die Kundendaten anzeigen zu lassen:

Public Sub makeHTML_auftrag_kunde()

Dim order_id_1
order_id_1 = Forms!hauptformular.Controls!order_id

Dim sprache
sprache = Forms!hauptformular.Controls!sprache_id


Dim Starturl_1 As String
Set db = CurrentDb
Set rs1 = db.OpenRecordset("SELECT sales_flat_order.entity_id AS order_id, label_varchar.labelname AS adresse_2, customer_entity.entity_id AS customer_id, customer_address_entity_varchar_firma_adresse.value AS firma_1, customer_address_entity_text_strasse.value AS strasse_1, customer_address_entity_varchar_firma_adresse_3.value AS plz_1, " & _
"customer_address_entity_varchar_firma_adresse_1.value AS ort_1, customer_address_entity_varchar_firma_adresse_2.value AS land_1, label_varchar_1.labelname AS contact_2, sales_flat_order.customer_firstname AS vorname_1, sales_flat_order.customer_lastname AS nachname_1, customer_address_entity_varchar_firma_adresse_4.value AS tel_1, " & _
"customer_address_entity_varchar_firma_adresse_5.value AS fax_1, customer_entity.email, label_varchar_2.labelname AS tel_2, label_varchar_3.labelname AS fax_2, label_varchar_4.labelname AS email_2 FROM label_varchar, label_varchar AS label_varchar_1, label_varchar AS label_varchar_2, label_varchar AS label_varchar_3, label_varchar AS label_varchar_4, (sales_flat_order INNER JOIN (((((((customer_entity INNER JOIN customer_address_entity ON customer_entity.entity_id = customer_address_entity.parent_id) " & _
"INNER JOIN customer_address_entity_text_strasse ON customer_address_entity.entity_id = customer_address_entity_text_strasse.entity_id) INNER JOIN customer_address_entity_varchar_firma_adresse ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse.entity_id) INNER JOIN customer_address_entity_varchar_firma_adresse AS customer_address_entity_varchar_firma_adresse_3 ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse_3.entity_id) INNER JOIN customer_address_entity_varchar_firma_adresse AS customer_address_entity_varchar_firma_adresse_1 ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse_1.entity_id) " & _
"INNER JOIN customer_address_entity_varchar_firma_adresse AS customer_address_entity_varchar_firma_adresse_2 ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse_2.entity_id) INNER JOIN customer_address_entity_varchar_firma_adresse AS customer_address_entity_varchar_firma_adresse_4 ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse_4.entity_id) ON sales_flat_order.customer_id = customer_entity.entity_id) INNER JOIN customer_address_entity_varchar_firma_adresse AS customer_address_entity_varchar_firma_adresse_5 ON customer_address_entity.entity_id = customer_address_entity_varchar_firma_adresse_5.entity_id " & _
"WHERE (((sales_flat_order.entity_id)= " & order_id_1 & ") AND ((label_varchar.label_id)=61) AND ((label_varchar_1.label_id)=62) AND ((customer_address_entity_varchar_firma_adresse.attribute_id)=95) AND ((customer_address_entity_varchar_firma_adresse_3.attribute_id)=14) AND ((customer_address_entity_varchar_firma_adresse_1.attribute_id)=15) AND ((customer_address_entity_varchar_firma_adresse_2.attribute_id)=11) AND ((customer_address_entity_varchar_firma_adresse_4.attribute_id)=17) AND ((customer_address_entity_varchar_firma_adresse_5.attribute_id)=18) AND ((label_varchar.language_id)= " & sprache & ") AND ((label_varchar_2.label_id)=30) AND ((label_varchar_2.language_id)= " & sprache & ") AND ((label_varchar_3.label_id)=31) AND ((label_varchar_3.language_id)= " & sprache & ") AND ((label_varchar_1.language_id)= " & sprache & ") AND ((label_varchar_4.label_id)=32) AND ((label_varchar_4.language_id)= " & sprache & "))", dbOpenDynaset)

Starturl_1 = "file:///" & Replace(CurrentProject.Path, "\", "/") & "/" & "index.html"

Open CurrentProject.Path & "\index.html" For Output As #1
Print #1, "<!DOCTYPE HTML PUBLIC " & Chr(34) & "-//W3C//DTD HTML 4.0 Transitional//EN" & Chr(34) & ">"
Print #1, "<!-- saved from url=(0013)about:internet -->"
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<link rel=""stylesheet"" type=""text/css"" href=""../css/styles.css"" />"
Print #1, "</head>"
Print #1, "<body>"
Print #1, "<div id = ""kunde"" >"

Print #1, "<h2 id = ""label_1"">" & rs1.adresse_2 & "</h2>"
Print #1, "<li id = ""value_1"">" & rs1.firma_1 & "</li>"
Print #1, "<li id = ""value_1"">" & rs1.strasse_1 & "</li>"
Print #1, "<li id = ""value_1"">" & rs1.plz_1 & ort_1 & "</li>"
Print #1, "<li id = ""value_1"">" & rs1.land_1 & "</li>"

Print #1, "<h2 id = ""label_1"">" & rs1.contact_2 & "</h2>"
Print #1, "<li id = ""value_1"">" & rs1.vorname_1 & rs1.nachname_1; "</li>"
Print #1, "<li id = ""value_1"">" & rs1.tel_1 & "</li>"
Print #1, "<li id = ""value_1"">" & rs1.fax_1 & "</li>"
Print #1, "<li id = ""value_1"">" & rs1.email & "</li>"

Print #1, "</div>"
Print #1, "</body>"
Print #1, "</html>"
Close #1

DoEvents
Forms!hauptformular.Controls!URL_1 = Starturl_1
Forms!hauptformular.Controls!WebBrowser2.Navigate Starturl_1
rs1.Close
Set rs1 = Nothing
Set db = Nothing
Forms!hauptformular.Controls!WebBrowser2.Visible = True

End Sub

Jetzt das Problem:

Er zeigt mir im zweiten WB die Kundendaten an, ändert aber auch im ersten WB den Inhalt und zeigt hier ebenfalls die Kundendaten an.

Hat jemand eine Idee, wo mein Fehler liegt??

Brauche dringend hierzu Hilfe!!!

Christian