Solved Filtered Meetings Query By Members

plz help me
I'm not sure if I understood your wishes correctly, but some result is below.
Code:
Private Sub CommandOpenMainForm_Click()
Dim sVal$

    If Me.MeetingByMember = True Then
        sVal = "MeetingsByMemberQ"
    Else
        sVal = "AllMeetingsQ"
    End If
    
    DoCmd.OpenForm "MainForm"
    Forms("MainForm").RecordSource = sVal
    
    'DoCmd.Close acForm, Me.Name
    Me.Visible = False
End Sub
 

Attachments

I'm not sure if I understood your wishes correctly, but some result is below.
Code:
Private Sub CommandOpenMainForm_Click()
Dim sVal$

    If Me.MeetingByMember = True Then
        sVal = "MeetingsByMemberQ"
    Else
        sVal = "AllMeetingsQ"
    End If
 
    DoCmd.OpenForm "MainForm"
    Forms("MainForm").RecordSource = sVal
 
    'DoCmd.Close acForm, Me.Name
    Me.Visible = False
End Sub

I'm not sure if I understood your wishes correctly, but some result is below.
Code:
Private Sub CommandOpenMainForm_Click()
Dim sVal$

    If Me.MeetingByMember = True Then
        sVal = "MeetingsByMemberQ"
    Else
        sVal = "AllMeetingsQ"
    End If
  
    DoCmd.OpenForm "MainForm"
    Forms("MainForm").RecordSource = sVal
  
    'DoCmd.Close acForm, Me.Name
    Me.Visible = False
End Sub
Thanks, I am trying hard to convert your code to Macro, but I could not ☹️
Kindly, can you help me convert your code to Macro please 🙏
 
I tried this but it doesn't work ☹️
plz help me!!! 🙏

Sample attached

1647003605282.png
 

Attachments

i also got confused.
i modify the db on post#21.
plz comment if this is what you need.
 

Attachments

i also got confused.
i modify the db on post#21.
plz comment if this is what you need.
Yes what you did is Perfect! it is works good!, but can you convert Eugene-LS VBA code to Macro?
becuse I want to know how to deal with Form Record Source
plz 🙏

Private Sub CommandOpenMainForm_Click()
Dim sVal$

If Me.MeetingByMember = True Then
sVal = "MeetingsByMemberQ"
Else
sVal = "AllMeetingsQ"
End If

DoCmd.OpenForm "MainForm"
Forms("MainForm").RecordSource = sVal

'DoCmd.Close acForm, Me.Name
Me.Visible = False
End Sub
 
Try that please:
Code:
'converting an embedded macro into code shows that the macro is incorrect
'------------------------------------------------------------
Function macro1()
On Error GoTo macro1_Err

    With CodeContextObject
        DoCmd.OpenForm "MainForm", acNormal, "", "", , acNormal
        If (.MeetingByMember = True) Then
            Forms ("MainForm" )[].RecordSource = "MeetingsByMemberQ"
        Else
            Forms ("MainForm" )[].RecordSource = "AllMeetingsQ"
        End If
    End With


macro1_Exit:
    Exit Function

macro1_Err:
    MsgBox Error$
    Resume macro1_Exit

End Function
 
converting an embedded macro into code shows that the macro is incorrect
... but it works, some how ...

Galina, please make your version - make us happy with your wisdom and knowledge.
@Sarah.M wants an exact macro - may the gods prolong his years.
... Well you remember what the great Alvik wrote about it ... :)
 
Last edited:
Code:
Function MACRO21()

    With CodeContextObject
        DoCmd.OpenForm "MainForm", acNormal, "", "", , acNormal
        If (.MeetingByMember = True) Then
            Forms!MainForm.RecordSource = "MeetingsByMemberQ"
        Else
            Forms!MainForm.RecordSource = "AllMeetingsQ"
        End If
        DoCmd.RepaintObject acForm, "MainForm"
    End With

End Function
 

Attachments

  • Screenshot_11-1945.png
    Screenshot_11-1945.png
    20.3 KB · Views: 140
Функция Макрос21

RU:
- Так у меня (в макросе) вроде так и написано!

EN:
It seems to be the same in my macro
Please explain - where is the error?
Although - no need, thanks - macros are not my domain.
 
It seems to be the same in my macro
en:
I always debug in a regular macro, which is easily translated into code for verification

the difference
with you is the name in quotation
marks with me - through an exclamation mark !

ru:
я всегда отлаживаю в обычном макросе, который легко переводится в код для проверки

отличие
у вас - имя в кавычках
у меня - через восклицательный знак !
 
@SHANEMAC51, Dear Galina, in my humble opinion we should follow the proverb:
"When in Rome do as the Romans do".
Or:
"You've got to play the game according to the local rules."
Or:
"V chuzoi monastir' so svoim ystavom ne hod'at!" (rus proverb)
:)
Let's stop talking in Russian on the general forum!
 
Try that please:
Thanks it works! (y)

I have a question out of curiosity, learning and knowledge
Item: why it is not looks like forms path? Forms![MainForm].[RecordSource]
Why Expression query name not in parentheses?

1647043469242.png
 

Users who are viewing this thread

Back
Top Bottom