Iron Speed Technical Forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
sdms

Registered:
Posts: 139
Reply with quote  #1 
I have an add record page on which there are several fields. Three of them are: Club Number, Name and Address. The Club Number is not the PK for this table. When the form opens there is a child TAB which automatically generates a new line so the user has to complete at least one child record. When the user enters the club number it does a "validate field immediately" (on text changed) which goes to a lookup table, does a match on the Club Number and populates the details of that club into the Name and Address fields.

What I want to do is after the text changed event fires and the name and address is populated into their respective fields is to populate/copy the Club Number into one of the fields in the child record row below.

I need to do this before any save button is clicked. I have looked at formulas and session variables but they dont seem to be applicable to my situation. This is easy to do with a formula if the field is on the same parent record page but I dont know how to copy/pass the parent field value down to the text field in the child table row immediately after it has been entered on the parent form. I would like to extend the code that enters the name and address so that after this occurs the club number gets populated into the child record field. I use VB.

Steve
Juanro

Avatar / Picture

Registered:
Posts: 104
Reply with quote  #2 
You have to manually enter the parent record control name, as if you were using the formula inside the parent. Use something like this in the Child's control initialize formula:
ParentRecordControl.ControlInParent.Text
I usually set up a dummy field in the parent control, use the formula assistant to help me build it and then copy it to the child control.
Bottom line: Although the right click don't show it, and the Help is not very clear about it, you really have all the ParentRecordControl's Control available inside the Child's formulas.

Hope this helps, regards.

Juanro
sdms

Registered:
Posts: 139
Reply with quote  #3 
Juanro

Thanks and yes its not clear in the help file, I added in the formuila but nothing happened after I typed in the Club Number. To prove if the formula was working I set a default value for Club Number and ran the page. When it opened the value was in my parent record field and it was also in my child record field  so the formula "ParentRecordControl.ControlInParent.Text" does work but only when I load the page and there is a default value in Club Number. I just cant work out how to get it to work after i manually enter the Club Number.

If I add the below code into the code that runs the on text changed event which fetches the name and address details I get a compile error "Reference to a non-shared member requires an object reference". I am assuming I need to add more than just the one line of code to get it to work or is there a way to leave it as a formula but somehow get the child field to "refresh" after I have manually entered in the Club Number in the parent field

KBChangeRegisterRecordControl.ClubNumber = Me.ClubNumber.Text
Juanro

Avatar / Picture

Registered:
Posts: 104
Reply with quote  #4 
The code in the ontextchanged I guess is client side code... the name or Id of your server controls will not work. What's the parent control wich fires the setting of the club number? Try setting AutoPostBack=true on that control.

Regards
Juanro
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement