Sorry in advance for my english. :-)
I have a form MS Access97 with two subforms. These subforms have different
data and dimensions, if into the main form I've selected with checkbox "Date
of delivery" instead "Item".
To select the right subforms I make use of this sub:
************************************************** ***
Private Sub opzSelezione_AfterUpdate()
Me!sfrmSelezione.Visible = False
Me!DescrDatoSelez.Visible = False
Me!sfrmDettaglioSel.Visible = False
Select Case Me!opzSelezione
Case 1 '*** Data consegna
'Sotto maschera Selezione
With Me!sfrmSelezione
.Width = 1700
.Height = 5490
.top = 113
.left = 56
.SourceObject = "Sk_ProdInCons_SelDate"
End With
'Descrizione Dato Selezionato
With Me!DescrDatoSelez
.Width = 9291
.Height = 288
.top = 113
.left = 1984
End With
'Sotto maschera Dettaglio Selezione
With Me!sfrmDettaglioSel
.Width = 9306
.Height = 4994
.top = 623
.left = 1979
.SourceObject = "Sk_ProdInCons_DateDett"
.LinkChildFields = ""
.LinkMasterFields = ""
.LinkChildFields = "DataPrevArrivo" ' = Date of
delivery
.LinkMasterFields = "DatoSelezionato"
.LinkChildFields = "DataPrevArrivo"
End With
Case 2 '*** Prodotto
'Sotto maschera Selezione
With Me!sfrmSelezione
.Width = 4535
.Height = 5490
.top = 113
.left = 56
.SourceObject = "Sk_ProdInCons_SelProd"
End With
'Descrizione Dato Selezionato
With Me!DescrDatoSelez
.Width = 6591
.Height = 288
.top = 113
.left = 4694
End With
'Sotto maschera Dettaglio Selezione
With Me!sfrmDettaglioSel
.Width = 6591
.Height = 4994
.top = 623
.left = 4699
.SourceObject = "Sk_ProdInCons_ProdDett"
.LinkChildFields = ""
.LinkMasterFields = ""
.LinkChildFields = "Prodotto" 'Item
.LinkMasterFields = "DatoSelezionato"
End With
End Select
Me!sfrmSelezione.Visible = True
Me!DescrDatoSelez.Visible = True
Me!sfrmDettaglioSel.Visible = True
Me!sfrmSelezione.SetFocus
End Sub
************************************************** ****
The default select is "Date of delivery", but when I select "Item" I receive
"Run-time error '2101'
The setting you entered isn't valid for this property."
The error occurring at the line ".LinkChildFields = "Prodotto" ' = Item
"
When the msgbox appear I click on then button of Debug and, if I repeat the
execution of the line ".SourceObject = "Sk_ProdInCons_DateDett" ",
next time then line ".LinkChildFields = "Prodotto" ' = Item " will be
execute correctly and I can see the right subform.
I don't know with sometimes my program works perfectly
Anyone can help me?
Thanks
Eugenio