Advertisement

04.14.2008 at 10:05AM PDT, ID: 23320981
[x]
Attachment Details

Unbound subform will not requery correctly

Asked by Loki in Microsoft Access Database

Tags: Microsoft, Access, 2007

I've searched through all of the solutions so far and haven't found one for my particular situation.

I have a database that I'm using to scrape invoice information from a mainframe screen and then write some of it to the main form and some of it to records, which are then displayed in a subform.  I'm not having any problems except for getting the subform to requery correctly.  Most times, the form stays blank after I send a me.sub1.requery command.  Sometimes it will work though.  I played around with it and figured out that it was a timing issue.  So I paused the code a bit before requery and it seems to work better, but it's not 100%.  Sometimes it still doesn't requery.  I never had a problem doing this kinda' thing on Access XP, but I recently got a new PC and it came with Access 2007.  Ever since, the littlest things have been messing me up.

Here is the code I'm using...
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
'Write Invoice Data records
    Set rst1 = New ADODB.Recordset
    rst1.Open "tbl_InvoiceData", conn, , adLockOptimistic
    rst1.AddNew
    rst1("InvoiceID") = strInvoiceID
    rst1("SalesOrderNumber") = Me.txtSONumber
    rst1("ReleaseNumber") = Me.txtRelNumber
    strPO = Trim(sess0.Screen.getstring(3, 41, 30))
    StripString (strPO)
    strPO = strHoldString
    rst1("CustomerPONumber") = strPO
    rst1("LineNumber") = ""
    rst1("Qty") = Trim(sess0.Screen.getstring(23, 16, 7))
    rst1("ItemNumber") = Trim(sess0.Screen.getstring(20, 9, 25))
    rst1("ItemDescription") = ""
    rst1("UnitValue") = Trim(sess0.Screen.getstring(20, 40, 13))
    rst1("ExtendedPrice") = Trim(sess0.Screen.getstring(21, 70, 11))
    'Get external data
    'Call ExternalData
    rst1("HarmonicCode") = ""
    rst1("HarmonicDescription") = ""
    rst1("CountryofOrigin") = ""
    rst1.Update
       
    'Check for "MORE" invoice data records
    strTest = Trim(sess0.Screen.getstring(2, 62, 4))
    If strTest = "MORE" Then
        intMore = 1
        w = 1
200
        X = 7
        sess0.Screen.SendKeys ("<pf8>")
        sess0.Screen.WaitForCursor 2, 14
        sess0.Screen.SendKeys (" ")
        sess0.Screen.WaitForCursor 2, 15
        For i = 1 To 3
            'Add new item
            strTest = Trim(sess0.Screen.getstring(X, 9, 25))
            'If IsNull(strTest) Then
            If strTest = "" Then
                Exit For
            End If
            rst1.AddNew
            rst1("InvoiceID") = strInvoiceID
            rst1("SalesOrderNumber") = Me.txtSONumber
            rst1("ReleaseNumber") = Me.txtRelNumber
            rst1("CustomerPONumber") = strPO
            rst1("LineNumber") = ""
            rst1("Qty") = Trim(sess0.Screen.getstring((X + 3), 16, 7))
            rst1("ItemNumber") = Trim(sess0.Screen.getstring(X, 9, 25))
            rst1("ItemDescription") = ""
            rst1("UnitValue") = Trim(sess0.Screen.getstring(X, 40, 13))
            rst1("ExtendedPrice") = Trim(sess0.Screen.getstring((X + 1), 70, 11))
            'Get external data
            'Call ExternalData
            rst1("HarmonicCode") = ""
            rst1("HarmonicDescription") = ""
            rst1("CountryofOrigin") = ""
            rst1.Update
            
            X = X + 5
        Next i
        strTest = Trim(sess0.Screen.getstring(2, 62, 4))
        If strTest = "MORE" Then
            GoTo 200
        End If
    End If
Else
    MsgBox "There is no data to scrape." & vbCrLf & " " & vbCrLf & "Please check to see if you've entered the correct sales order info."
End If
 
sess0.Screen.SendKeys ("<pf3>")
 
'Pause and requery
For intWait = 1 To 3000
    DoEvents
Next intWait
Me.sub1.Requery
 
rst1.Close
conn.Close
[+][-]04.14.2008 at 12:36PM PDT, ID: 21353048

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 12:41PM PDT, ID: 21353096

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 12:45PM PDT, ID: 21353128

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 12:49PM PDT, ID: 21353176

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 12:50PM PDT, ID: 21353188

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 12:55PM PDT, ID: 21353227

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 01:00PM PDT, ID: 21353271

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 01:03PM PDT, ID: 21353302

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 01:11PM PDT, ID: 21353371

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.14.2008 at 01:15PM PDT, ID: 21353409

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Tags: Microsoft, Access, 2007
Sign Up Now!
Solution Provided By: DatabaseMX
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.14.2008 at 01:27PM PDT, ID: 21353525

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.15.2008 at 07:57AM PDT, ID: 21359261

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628