dbTalk Databases Forums  

Unbound controls

comp.databases.ms-access comp.databases.ms-access


Discuss Unbound controls in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mo
 
Posts: n/a

Default Unbound controls - 10-03-2011 , 03:29 AM






I have a form with a subform. The subform contains a bound combo box,
from which the user can select a parent. The subform also displays some
other data relating to the parent in a number of unbound controls. These
get updated when the user makes a selection from the combo box.

If the parent does not appear in the list, the users clicks on the 'Add
New Parent' button, which opens another form. Here the user can add a
parent, go back to the other form/subform, where the new parent now
appears in the combo. All of this works fine.

However, if the user wants to edit the parent data, I run into problems.
The user opens the same form as they did to add a parent, which now
displays the data relating to the parent they want to edit. They edit,
close and save the record successfully.

When the user goes back to the form/subform, I can requery the combo box
on the subform with:

Forms!MainForm!SubForm!combobox.requery

How do I requery the contents of the unbound controls on the subform to
show the edited data? I understand that the requery method will not work
with unbound controls. I've tried .reclac, .refresh, .repaint with no
success.

TIA

Reply With Quote
  #2  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 04:37 AM






"Mo" <m.a.joomun (AT) qmul (DOT) ac.uk> wrote

Quote:
I have a form with a subform. The subform contains a bound combo box, from
which the user can select a parent. The subform also displays some other
data relating to the parent in a number of unbound controls. These get
updated when the user makes a selection from the combo box.

If the parent does not appear in the list, the users clicks on the 'Add
New Parent' button, which opens another form. Here the user can add a
parent, go back to the other form/subform, where the new parent now
appears in the combo. All of this works fine.

However, if the user wants to edit the parent data, I run into problems.
The user opens the same form as they did to add a parent, which now
displays the data relating to the parent they want to edit. They edit,
close and save the record successfully.

When the user goes back to the form/subform, I can requery the combo box
on the subform with:

Forms!MainForm!SubForm!combobox.requery

How do I requery the contents of the unbound controls on the subform to
show the edited data? I understand that the requery method will not work
with unbound controls. I've tried .reclac, .refresh, .repaint with no
success.

TIA
Presumably you're using the AfterUpdate event of the combo to update the
unbound controls. So to update them when you requery it, call it's
AfterUpdate as well.

Reply With Quote
  #3  
Old   
Mo
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 05:51 AM



Quote:
Presumably you're using the AfterUpdate event of the combo to update the
unbound controls. So to update them when you requery it, call it's
AfterUpdate as well.


Hello,

Thanks for the reply.

I am using the following with no success:

Call Forms.frmPerson.frmMotherSub.Form.cmbMother_AfterU pdate

Reply With Quote
  #4  
Old   
Phil
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 06:18 AM



On 03/10/2011 11:51:04, Mo wrote:
Quote:

Presumably you're using the AfterUpdate event of the combo to update the
unbound controls. So to update them when you requery it, call it's
AfterUpdate as well.



Hello,

Thanks for the reply.

I am using the following with no success:

Call Forms.frmPerson.frmMotherSub.Form.cmbMother_AfterU pdate




Excuse me asking, but why are'nt the subform's controls bound?

Phil

Reply With Quote
  #5  
Old   
Mo
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 06:56 AM



On 03/10/2011 12:18, Phil wrote:
Quote:
On 03/10/2011 11:51:04, Mo wrote:


Presumably you're using the AfterUpdate event of the combo to update the
unbound controls. So to update them when you requery it, call it's
AfterUpdate as well.



Hello,

Thanks for the reply.

I am using the following with no success:

Call Forms.frmPerson.frmMotherSub.Form.cmbMother_AfterU pdate





Excuse me asking, but why are'nt the subform's controls bound?

Phil

It doesn't appear to make any difference. I'm not able to get the
controls on 'frmMotherSub' to show updated data when I close the form to
edit parents' details.

Reply With Quote
  #6  
Old   
Mo
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 07:17 AM



On 03/10/2011 12:56, Mo wrote:

Quote:
Excuse me asking, but why are'nt the subform's controls bound?

Phil


I think I may have found the answer. If I use the following:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Before I do this:

Call Forms.frmPerson.frmMotherSub.Form.cmbMother_AfterU pdate

it seems to work.

Reply With Quote
  #7  
Old   
Phil
 
Posts: n/a

Default Re: Unbound controls - 10-03-2011 , 07:30 AM



On 03/10/2011 12:56:52, Mo wrote:
Quote:
On 03/10/2011 12:18, Phil wrote:
On 03/10/2011 11:51:04, Mo wrote:


Presumably you're using the AfterUpdate event of the combo to update the
unbound controls. So to update them when you requery it, call it's
AfterUpdate as well.



Hello,

Thanks for the reply.

I am using the following with no success:

Call Forms.frmPerson.frmMotherSub.Form.cmbMother_AfterU pdate





Excuse me asking, but why are'nt the subform's controls bound?

Phil


It doesn't appear to make any difference. I'm not able to get the
controls on 'frmMotherSub' to show updated data when I close the form to
edit parents' details.

Firstly, the word "Parent" is confusing, as if you refere to the main form
from a subform, you use the VBA word "Me.Parent"

Assuming we are talking about parents in terms of families, and assuming your
table of Parents contains fields lile ParentID Autonumber
ParentName Text
then you have a main form with all the parent's details and an unbound Combo
box with the RowSource "SELECT ParentName. ParentID FROM Parents ORDER BY
ParentName;" Bound Column is 2
Widths 5cms; 0 cms (Hide the ParentID column)
Then a bit od code on the AfterUpdate of the Combo box - Let's call the Combo
"FindParent"

Private Sub FindParent_AfterUpdate()

DoCmd.GoToControl "ParentID"
DoCmd.FindRecord FindParent

End Sub

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.