Solved

Access Visual basic Statement in statement How To

Posted on 2013-01-29
4
412 Views
Last Modified: 2013-01-29
Microsoft Access Visual Basic 2007

I have this:

S2 = "[" & Me.Select1 & "]"
 
Forms!main.Form!Data.S2.ColumnHidden = False


Notice, i'm trying to use the S2 in the second statement.

But this won't work, can someone please provide a suggestion about how to go about this?
0
Comment
Question by:Ursino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 38832665
Did you try it without the &'s?

S2 = "[Me.Select1]"

Flyster
0
 
LVL 48

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38832672
Try something like:

Forms!Main!subformControlName.Form.Controls(me.Select1).ColumnHidden = False

I assume you are trying to unhide a column in a datasheet that is being used as a subform on you main form.  Where is this code firing from?  Is it a control on the main form?  If so, you should be able to use something like:

me.subformControlName.Form.Controls(me.Select1).ColumnHidden = false

Note:  subformControlName refers to the NAME of the subform CONTROL, not the name of the form that is the SourceObject of the subform.
0
 

Author Closing Comment

by:Ursino
ID: 38832753
This worked like a charm, all assumptions made were correct.
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 38832799
glad I could help.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question