0
votes

I'm trying to have a combobox change the subform that is on my mainform. My issue is that in Swedish nouns, verbs and adjectives change form, so if I'm adding a new noun into my mainform, then the subform associated with inputting nouns needs to dynamically load.

I've wrote a little VBA to assist but I cannot get it to work properly:

Private Sub combobox_Grammatik_Klass_Change()

Select Case Me.combobox_Grammatik_Klass.Text
    Case "Substantiv"
        Me.subfrm_Orden.SourceObject = "frm_Substantiv_Ord"
        Me.Singular_Obestämd.Text = Me.txtbox_Ord.Text
    Case "Verb"
        Me.subfrm_Orden.SourceObject = "frm_Verb_Ord"
        Me.Attributivt_Utrum_Singular_Obestämd_Positiv.Text = Me.txtbox_Ord.Text
    Case "Adjektiv"
        Me.subfrm_Orden.SourceObject = "frm_Adjektiv_Ord"
        Me.Aktiv_Infinitiv.Text = Me.txtbox_Ord.Text
    Case Else
       ' Me.subfrm_Orden.SourceObject = "frm_Alla_Andra_Orden"
       ' Me.Ord.Text = Me.txtbox_Ord.Text
End Select

End Sub

Main form = Ord_Inmatning_Blankett (Word Input Form)

Subform = frm_Alla_Andra_Orden (All other words), frm_Adjektiv_Ord (Adjective Words), frm_Verb_Ord (Verb Words), and frm_Substantiv_Ord (Noun Words)

Subform control = subfrm_Orden

Thank you!

1
The text property is only available when a control has focus. Either use the value property or just skip the property and it will default to value.Fionnuala
Could not all these words be in the same table with a definition of noun etc? It would make life a lot easier.Fionnuala
It would make life easier, the issue is that I'm trying to keep word-types together. E.g. the word kör, can be present tense for the word 'drive', a verb, yet it also means choir or chorus, a noun, when relating these words back to English, I want to keep the word type (grammatik klass) the separator between reverse translating. All in all, adding the words to one table is not an option.Mikael
I think it is. All you need is a classifier. You can have the same word a dozen times with a different classifier. So the table has kör, noun and kör, verb -- two fields in each case.. You can add a tense if preferred.Fionnuala
Fionnuala, that wouldn't really help. Their are 8 noun word forms, 12 verb word forms, and 15 adjective word forms, per each word. That is a lot of hiding of fields if say I just want to input kör as a noun, as the other options shouldn't even been seen unless it relates to the word at hand. This is why I have separate forms for Nouns, Adjectives and Verbs.Mikael

1 Answers

0
votes

Figured out the issue, here is the code:

Private Sub combobox_Grammatik_Klass_Change()

Select Case Me.combobox_Grammatik_Klass.Text
    Case "Substantiv"
        Me.subfrm_Orden.SourceObject = "frm_Substantiv_Orden"
        Me.subfrm_Orden!Singular_Obestämd = Me.txtbox_Ord
    Case "Verb"
        Me.subfrm_Orden.SourceObject = "frm_Verb_Orden"
        Me.subfrm_Orden!Attributivt_Utrum_Singular_Obestämd_Positiv = Me.txtbox_Ord
    Case "Adjektiv"
        Me.subfrm_Orden.SourceObject = "frm_Adjektiv_Orden"
        Me.subfrm_Orden!Aktiv_Infinitiv = Me.txtbox_Ord
    Case Else
        ' Me.subfrm_Orden.SourceObject = "frm_Alla_Andra_Orden"
        ' Me.subfrm_Orden!Ord = Me.txtbox_Ord
End Select

End Sub