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_Af terUpdate()
Me!sfrmSelezion e.Visible = False
Me!DescrDatoSel ez.Visible = False
Me!sfrmDettagli oSel.Visible = False
Select Case Me!opzSelezione
Case 1 '*** Data consegna
'Sotto maschera Selezione
With Me!sfrmSelezion e
.Width = 1700
.Height = 5490
.top = 113
.left = 56
.SourceObject = "Sk_ProdInCons_ SelDate"
End With
'Descrizione Dato Selezionato
With Me!DescrDatoSel ez
.Width = 9291
.Height = 288
.top = 113
.left = 1984
End With
'Sotto maschera Dettaglio Selezione
With Me!sfrmDettagli oSel
.Width = 9306
.Height = 4994
.top = 623
.left = 1979
.SourceObject = "Sk_ProdInCons_ DateDett"
.LinkChildField s = ""
.LinkMasterFiel ds = ""
.LinkChildField s = "DataPrevArrivo " ' = Date of
delivery
.LinkMasterFiel ds = "DatoSelezionat o"
.LinkChildField s = "DataPrevArrivo "
End With
Case 2 '*** Prodotto
'Sotto maschera Selezione
With Me!sfrmSelezion e
.Width = 4535
.Height = 5490
.top = 113
.left = 56
.SourceObject = "Sk_ProdInCons_ SelProd"
End With
'Descrizione Dato Selezionato
With Me!DescrDatoSel ez
.Width = 6591
.Height = 288
.top = 113
.left = 4694
End With
'Sotto maschera Dettaglio Selezione
With Me!sfrmDettagli oSel
.Width = 6591
.Height = 4994
.top = 623
.left = 4699
.SourceObject = "Sk_ProdInCons_ ProdDett"
.LinkChildField s = ""
.LinkMasterFiel ds = ""
.LinkChildField s = "Prodotto" 'Item
.LinkMasterFiel ds = "DatoSelezionat o"
End With
End Select
Me!sfrmSelezion e.Visible = True
Me!DescrDatoSel ez.Visible = True
Me!sfrmDettagli oSel.Visible = True
Me!sfrmSelezion e.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 ".LinkChildFiel ds = "Prodotto" ' = Item
"
When the msgbox appear I click on then button of Debug and, if I repeat the
execution of the line ".SourceObj ect = "Sk_ProdInCons_ DateDett" ",
next time then line ".LinkChildFiel ds = "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