• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

Solved Updating Sub-form with OnClick event of other Sub-Form (1 Viewer)

evictme

Registered User.
Local time
Today, 06:05
Joined
May 18, 2011
Messages
120
Hey Guys,

Back at it with some VBA mischief...Looking for a little help on syntax with an OnClick event that is not firing very well/at all.

I have the mainform (Mission Control) and two sub-forms (AuditClicksMC) and (Current-User)

I've wanted to filter the (AuditClicksMC) based on the OnClick event of the (Current-User) and have tried the code below, the code has only worked well 1 time. Every other time it has asked me to enter the parameter, the parameter field name being the value that I am trying to use as a filter...How do I apply the field.value directly as the filter?

Ive tried and (Me.logged_In) and (me.Logged_in.Value)
[Forms]![Mission Control]![AuditClicksMC].Form.Filter = "User =" & Me.Logged_In
[Forms]![Mission Control]![AuditClicksMC].Form.FilterOn = True

Any suggestions?
 

June7

AWF VIP
Local time
Today, 03:05
Joined
Mar 9, 2014
Messages
3,348
What you have should work if User is a number field.

If you want to provide db for analysis, follow instructions at bottom of my post.

Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention.
 

evictme

Registered User.
Local time
Today, 06:05
Joined
May 18, 2011
Messages
120
What you have should work if User is a number field.

If you want to provide db for analysis, follow instructions at bottom of my post.

Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention.
User name is not a number field
 

evictme

Registered User.
Local time
Today, 06:05
Joined
May 18, 2011
Messages
120
What you have should work if User is a number field.

If you want to provide db for analysis, follow instructions at bottom of my post.

Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention.
Got it now! I keep forgetting the syntax is different when the field is not a number. The code below works perfectly.

[Forms]![Mission Control]![AuditClicksMC].Form.Filter = "User =""" & [Forms]![Mission Control]![User] & """"
[Forms]![Mission Control]![AuditClicksMC].Form.FilterOn = True
 

June7

AWF VIP
Local time
Today, 03:05
Joined
Mar 9, 2014
Messages
3,348
And use # for date/time field.

I prefer an apostrophe to doubled quotes.
Code:
"User ='" & [Forms]![Mission Control]![User] & "'"
 

Users who are viewing this thread

Top Bottom