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

evictme

Registered User.
Local time
Today, 10:11
Joined
May 18, 2011
Messages
168
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, 07:11
Joined
Mar 9, 2014
Messages
5,425
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, 10:11
Joined
May 18, 2011
Messages
168
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, 10:11
Joined
May 18, 2011
Messages
168
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, 07:11
Joined
Mar 9, 2014
Messages
5,425
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