Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LinkMaster fields in subform problem

Status
Not open for further replies.

colinbell

Technical User
Jul 15, 2004
50
GB
Hi

I have this code which worked fine in Access 97 - now we're using Access 2002 it doesn't ! and it doesn't like me trying to manipulate the subform on the fly, as per the last 3 lines of the code below
anybody know why ?
regards
ian

i.e. can't change the linkchildfields and linkmasterfields or set its control source

DoCmd.openform stDocName, , , stLinkCriteria, acFormEdit
Forms!frmactions_TRAINING!frmTRAIN_links.SourceObject = "frmTRAIN_links"
Forms!frmactions_TRAINING!frmTRAIN_links.Requery
Forms!frmactions_TRAINING!Command272.Enabled = False
Forms!frmactions_TRAINING!Command987.Enabled = True
Forms!frmactions_TRAINING!Command1022.Enabled = True
Forms!frmactions_TRAINING!Ref.ControlSource = "Ref"
Forms!frmactions_TRAINING!saref.ControlSource = "saref"
Forms!frmactions_TRAINING!Type.ControlSource = "Type"
Forms!frmactions_TRAINING!directorate.ControlSource = "directorate"
Forms!frmactions_TRAINING!counter.ControlSource = "counter"
Forms!frmactions_TRAINING!new_service.ControlSource = "new_service"
Forms!frmactions_TRAINING!TRAIN_cost.ControlSource = "TRAIN_cost"
str = "SELECT TRAIN_type, TRAINstatus from tblactions where saref = '" & Forms!frmactions_TRAINING!saref & "'"
Set rst = db.OpenRecordset(str)
Forms!frmactions_TRAINING!Frame988.ControlSource = "TRAINstatus"
Forms!frmactions_TRAINING!Frame988 = Val(rst("TRAINstatus"))
'Forms!frmactions_TRAINING!Frame988 = 2
Forms!frmactions_TRAINING!TRAIN_CompDate.ControlSource = "TRAIN_CompDate"
str1 = "SELECT TRAIN_type, TRAINstatus from tblactions where saref = '" & Forms!frmactions_TRAINING!saref & "'"
Set rst = db.OpenRecordset(str1)
Forms!frmactions_TRAINING!Frame1001.ControlSource = "TRAIN_type"
Forms!frmactions_TRAINING!Frame1001 = Val(rst("TRAIN_type"))
Forms!frmactions_TRAINING!action_desc.ControlSource = "action_desc"
Forms!frmactions_TRAINING!TRAINcat.ControlSource = "TRAINcat"
Forms!frmactions_TRAINING!TRAINsub.ControlSource = "TRAINsub"
Forms!frmactions_TRAINING!contra.ControlSource = "contra"
Forms!frmactions_TRAINING!monitor.ControlSource = "monitor"
Forms!frmactions_TRAINING!shared.ControlSource = "shared"
Forms!frmactions_TRAINING!TRAIN_FinalEval.ControlSource = "TRAIN_FinalEval"
Forms!frmactions_TRAINING!EmpNo.ControlSource = "EmpNo"
Forms!frmactions_TRAINING!employee.ControlSource = "employee"
Forms!frmactions_TRAINING!Command270.Caption = "Save Record"
Forms!frmactions_TRAINING!Command270.ForeColor = 16711680
Forms!frmactions_TRAINING!frmTRAIN_links.ControlSource = "SELECT tblPAIS_links.Ref, tblPAIS_links.ID_link, tblPAIS_links.PAIS_SECT, tblPAIS_links.SECT_PAIS, tblPAIS_links.desc1, tblPAIS_links.SECT_link FROM tblPAIS_links WHERE (((tblPAIS_links.Ref)=forms!frmactions_TRAINING!Ref))"
' Forms!frmactions_TRAINING!frmTRAIN_links.LinkMasterFields = "Ref"
' Forms!frmactions_TRAINING!frmTRAIN_links.LinkChildFields = "Ref"
 
Have you tried to replace this:
Forms!frmactions_TRAINING!frmTRAIN_links.ControlSource =
By this ?
Forms!frmactions_TRAINING!frmTRAIN_links.Form.RecordSource =

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks

I should have spotted that I was trying to affedct the controlsource and not the recordsource.
anyway it now says
the expression you entered refers to an object that is closed or doesn;t exist ?
it does exist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top