hotmert
Reaction score
0

Profile posts Latest activity Postings About

  • Hi Mert,

    Maybe I didn't explain a few things that I should have. Try the following.

    The ListBox 'Row Soure Type' needs to be set to 'Value List'.

    In the line below where frm!Text is replace it with frm! and the name of the control that is on the form named 2, I don't remember the name of the control.
    If Test = "" Then Test = frm!Text Else Test = Test & ";" & frm!Text

    When adding an event procedure to a property you need to place the curser on the line of the property and then click on the button with the ... on it to the right side of the property line. 'On Current ______________ [] ...' It looks kind of like this.
    After clicking the ... button select code builder.

    Hope this helps.

    Art
    Hi Mert,

    You must be missing a referance for the 'Me' not to work. Replace 'Me' with Forms!FormName, where FormName is the actual name of your form that this code is in.

    I believe the propblem with Forms!2 is that it see the 2 as a number and not text. You could change the name of the form or us this instead Forms("2").

    Hope this helps.

    Art
    Hi Mert,

    You can try this to get what you orginally asked for.

    Remove your subform named 2 from your main form, do not delete it. Replace it with a ListBox with the columns set to 3. Size it to what you need. Create a code like this in a module. I can't remember if the field named Number was a text or an actual number. If it was a text you will have to change dblNumber to a string and when opening the form use this "[Number]='" & frm!Number & "'"

    Function Test(dblNumber As Double) As String
    On Error GoTo NoRecord
    Dim frm As Form
    DoCmd.OpenForm "2", , , "[Number]=" & dblNumber, , acHidden
    Set frm = Forms!2
    Do
    If Test = "" Then Test = frm!Text Else Test = Test & ";" & frm!Text
    DoCmd.GoToRecord acDataForm, frm.Name, acNext
    Loop
    NoRecord:
    DoCmd.Close acForm, frm.Name
    End Function

    On the oncurrent property of the main form add this in an evvent procedure.

    Me!List0.RowSource = Test(Me![Number])

    Replace List0 with the name of your listbox.

    You can use this on a report but instead of the oncurrent property use the onopen property.

    This will work. This will slow down your database.

    Hope this helps.

    Art
  • Loading…
  • Loading…
  • Loading…
Back
Top Bottom