Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


msaccess putting fragmented strings to enabe a field object read

Posted on 2011-03-13
Medium Priority
Last Modified: 2012-05-11
in access from a form i need to pass the form name ie Forms![Questions2:2]  as well as the object name that is clicked ie  "2:1:1"  whcih woudl be a slect box id name anb then put it back together as in Forms![Questions2:2]![2:2:1].Value. which i can use to find the value of. this is the one line as you would use to find the value of the object.

so then i could find the value as in msgbox(Forms![Questions2:2]![2:2:1].Value)
which would then diisplay the value of the check box.
i have so many check boxes that i just want to call using the place that it omes from ie
"Forms![Questions2:2]" and the object name ie  "2:2:1" put it back together and be able to use
MsgBox (Forms![Questions2:2]![2:2:1:2].Value)

or as the entire line is deliver as in  
call findval("Forms![Questions2:2]![2:2:1:2].Value")  
how would i strip the " away and then be able to use
data = Forms![Questions2:2]![2:2:1:2].Value  to find the value

Private Sub Ctl2_2_1_1_Click()
    MsgBox Forms![Questions2:2]![2:2:1:2].Value
End Sub
Question by:sydneyguy
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
  • 4
LVL 85

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 35127176
I'm not exactly sure what you're asking, but Access provides the ActiveControl method and the PreviousControl method. The Form name is simply Me.Name, so if you need to pass that information to a function named SetMyValue:

Function SetMyValue(FormName as String, ControlName As String)
  <function code here>
End Function

You'd call it like this:

SetMyValue Me.Name, Screen.PreviousControl.Name

Once there, you can refer to the form's control like this:


However, I may have misunderstood this question, since it's somewhat vague. If so, please clarify exactly what you're trying to do and we'll see if we can help.

Author Comment

ID: 35153045
have tried what you suggested with no luck so to give a better idea of what is happening i built a small db with the first part of the problem set up in side
just go the the only form that is there sender and click the first tick box and the debug will crash on the code that i am having trouble with.
once it gets here what i am doing is using this chkbox name to pull back from a data base a grouping that this check box is part of, then i retrive the other names that are also in that group and then use this data to then refer back to the form to check the other values  that have been returned and access what they are set to.
i have some notes listed on the data page were the line crashes to make life easy for you
thanks for your help
just open the sender form and click the first check box

Author Comment

ID: 35153063
Data = Forms(sender).Controls("Check1").Value

allows me to get the data in reassembled format that works

Author Comment

ID: 35153078
ok so this code seems to be working now, i can now extract any code i want from the first call routine

Data = Forms(sender).Controls("Check1").Value
testval = "Check2"
Data1 = Forms(sender).Controls(testval).Value
MsgBox Data1

Author Closing Comment

ID: 35153284
ok thats works for and have tried it in the module call and allows me to access, now all i have to do is to extract the data from the pages from the data base and that looks to be working as well, so at present it seems to be doing what i am asking of it
so thanks again for your all your help and effort ,most appreciated

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

604 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