By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

Requery Sub after update of another sub both on an unbound form

P: n/a
I have a unbound form with 2 subforms. It looks something like this

_______________________________________________
| [Main} (Some Controls) |
| |
|_____________________________________________|
| [Sub 1] | [Sub 2] |
| | |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |

| | |
| | |
| | |
| | |
| | |
| | |
| | |
|_______________________________|_____________|

BY setting the Control Source Property to a SQL Statement I'm able to
get the correct values in each Subform. Sub 2, when it loads, looks at
the AIKey value and pulls the correct detail. The initial display
operates exactly like I want. The problem is when I go to the next
record in [Sub1], [Sub 2] doesn't update. If I manually select a field
in [sub 2] and do a Shift+F9 the field updates. Ok, I think, all I have
to do is a requery of [Sub 2]. I can't for the life of me figure out
how to do that through a Macro and any attempt in VBA seems to meet the
same fate.

Before someone asks... This form is read only. It is used to get an
overview of the status of "action items" .

Any Help would be appreciated!
Chris
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Chris Belcher <ch******@bellsouth.net> wrote in message news:<9r****************@bignews1.bellsouth.net>.. .
I have a unbound form with 2 subforms. It looks something like this

_______________________________________________
| [Main} (Some Controls) |
| |
|_____________________________________________|
| [Sub 1] | [Sub 2] |
| | |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |
| AIKey Other Data | Detail |

| | |
| | |
| | |
| | |
| | |
| | |
| | |
|_______________________________|_____________|

BY setting the Control Source Property to a SQL Statement I'm able to
get the correct values in each Subform. Sub 2, when it loads, looks at
the AIKey value and pulls the correct detail. The initial display
operates exactly like I want. The problem is when I go to the next
record in [Sub1], [Sub 2] doesn't update. If I manually select a field
in [sub 2] and do a Shift+F9 the field updates. Ok, I think, all I have
to do is a requery of [Sub 2]. I can't for the life of me figure out
how to do that through a Macro and any attempt in VBA seems to meet the
same fate.

Before someone asks... This form is read only. It is used to get an
overview of the status of "action items" .

Any Help would be appreciated!
Chris


In the Form_Current() code of subform1 I have:

Call Form_frmMain.RequerySubform2(CStr(Me.IdIDO))

Then in the frmMain code:

Public Sub RequerySubform2(strIdIDO As String)
'Set visible = false and make visible to keep subform OnCurrent from
running when the main form first opens
If Subform2.Visible = False Then
Subform2.Visible = True
Exit Sub
End If
Subform2.Form.RecordSource = "SELECT * FROM tblIDOItems WHERE IdIDO =
" & strIdIDO & " ORDER BY IdItem;"
Subform2.Form.Refresh
Subform2.Form.Repaint 'this line may not be needed
If Subform1.Form.MaterialProcessed = True Then
Subform2.Form!Process.Locked = True
Else
Subform2.Form!Process.Locked = False
End If
End Sub

I don't remember why I did it this way, but it worked.

James A. Fortune
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.