Solved Filtered Meetings Query By Members (1 Viewer)

Eugene-LS

Registered User.
Local time
Today, 10:47
Joined
Dec 7, 2018
Messages
481
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

  • 14_v02.zip
    62.5 KB · Views: 132

Sarah.M

Member
Local time
Today, 10:47
Joined
Oct 28, 2021
Messages
335
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 🙏
 

Sarah.M

Member
Local time
Today, 10:47
Joined
Oct 28, 2021
Messages
335
I tried this but it doesn't work ☹️
plz help me!!! 🙏

Sample attached

1647003605282.png
 

Attachments

  • 15.accdb
    896 KB · Views: 120

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:47
Joined
May 7, 2009
Messages
19,169
i also got confused.
i modify the db on post#21.
plz comment if this is what you need.
 

Attachments

  • 14_arnelgp.zip
    73.2 KB · Views: 121

Sarah.M

Member
Local time
Today, 10:47
Joined
Oct 28, 2021
Messages
335
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
 

Sarah.M

Member
Local time
Today, 10:47
Joined
Oct 28, 2021
Messages
335
i also got confused.
i modify the db on post#21.
plz comment if this is what you need.
I tried this but it is not working with me
Sample attached
1647009695190.png
 

Attachments

  • 16.accdb
    896 KB · Views: 120
Last edited:

SHANEMAC51

Active member
Local time
Today, 10:47
Joined
Jan 28, 2022
Messages
310
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
 

Eugene-LS

Registered User.
Local time
Today, 10:47
Joined
Dec 7, 2018
Messages
481
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:

SHANEMAC51

Active member
Local time
Today, 10:47
Joined
Jan 28, 2022
Messages
310
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: 105

Eugene-LS

Registered User.
Local time
Today, 10:47
Joined
Dec 7, 2018
Messages
481
Функция Макрос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.
 

SHANEMAC51

Active member
Local time
Today, 10:47
Joined
Jan 28, 2022
Messages
310
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:
я всегда отлаживаю в обычном макросе, который легко переводится в код для проверки

отличие
у вас - имя в кавычках
у меня - через восклицательный знак !
 

Eugene-LS

Registered User.
Local time
Today, 10:47
Joined
Dec 7, 2018
Messages
481
@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!
 

Sarah.M

Member
Local time
Today, 10:47
Joined
Oct 28, 2021
Messages
335
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

Top Bottom