Using A String Concatenation To Refer To A Control Name?
Feb 28, 2015
know if there is a way to use a string concatenation to refer to a control name. eg. Referring to Control1, Control2, Control3, Control4, etc using something like Me.["Control" & "1"], Me.["Control" & "2"], etc
View Replies
ADVERTISEMENT
Sep 14, 2007
In the table, i already had a few columns:
string1 string2 string3
001 1 1.5
001 2 6.4
I'd like to add a new column and concatenate the strings in previous columns with additional characters:
string1 string2 string3 string4
001 1 1.5 c-001-b01_1_5x
001 2 6.4 c-001-b02_6_4x
002 3 7 c-002-b03_7x
Is there a good way to do this? Thanks in advance.
View 2 Replies
View Related
Dec 13, 2005
This really is more of a VB than an Access question, but I need it answered, and I don't know a good VB forum so....
I have a text box that I'm trying to add text to, I have a loop, and every time through the loop it's supposed to concatenate new text into the text box by appending it to the end. I can't seem to be able to find a way to do this. I can't use the <&> operator, and VB doesn't have a <+=> operator (I wish I could do this in C/C++, but oh well). Any ideas? Or do I have to set the existing text to a string, concatenate the new text onto that, and then set it to the textbox?
View 3 Replies
View Related
Mar 7, 2008
Hi all
Is it possible to use a variable to finish the name of a control?
e.g.
Cell = me.A1 (where A1 is a lablel with the name a1)
forms![Myform]! "Cell".forecolor = 65280
What I am basically trying to do is to have a variating control name that i can change the color of.....too long to explain why really.
Can anyone help me please....is this possible?
Thanks
View 8 Replies
View Related
Nov 14, 2006
Still beating my head on the wall. I'm sure it is simple but I NEED guidance.
I've made a macro to show a date field when the "Yes" option button is selected and hide it when the "No" option button is selected. I first created it for the form to act on its own --> and it works. Now I want to use that form as a subform in the form [frmTestPkg]. I am having problems figuring out how to reference it properly as a subform.
Here's my macro that works when I attach it directly to my form:
Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus]
Action: SetValue
Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible]
Expression:No
Location: "On Got Focus" Event for the option button "No"
Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus]
Action: SetValue
Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible]
Expression:Yes
Location: "On Got Focus" Event for the option button "yes"
I have followed the pattern provided previously of
Forms![main form name]![subform control name].Form![control name]
but cannot get it to work -- obviously messing up somehow.
The reference I tried in the condition looks like this
[Forms]![frmTestPkg]![frmsubcruiseplan].[Form]![crplanrecvdNo].[OnGotFocus]
--> and with or without the setvalue information included I get a "The object you referred to as an OLE object isn't an OLE object" error.
Perhaps I am not identifying the subform control name properly? Or maybe I should be referring to the "Cruise Plan Recvd Option" instead of the individual control boxes (but it worked as a form)? Please spell it out for an idiot, what this is supposed to look like. Many thanks!
View 1 Replies
View Related
Feb 12, 2014
I have a report with several subreports. I need to total the subreports onto the main report. How do I refer to the control on the subreport?I know that with a form / subform I would use: Me!Subform1.Form!Controlname.But simply replacing 'Form' with 'Report' doesn't seem to work.
View 1 Replies
View Related
Aug 16, 2006
Hi!
I've developed a form to be standalone. It's based on a query with filter like this:
Like "*" & [Forms]![myForm]![Fltr1]
(The Fltr1 is a combox value.)
Now when i place the form "myForm" as a subform in another form (FormMain), the query does not give me any data.
How do i refer to the filter from the query??
Any help will be much appreciated!
thanks ;)
View 2 Replies
View Related
Oct 10, 2006
I have a main form with a subform. On a subform I created a combobox which I want to populate with ClassIDs that match the main forms Individual. I know the criteria in VBA for the above would look something like this:
"SELECT tblClassesAttended.ClassID FROM tblClassesAttended WHERE blClassesAttended.IndividualID=" & Me.Parent!IndividualID
but when I type such statement in the row source of the control it does not work. What is the correct way of refering to the parent form when typing the SQL in the row source?
BTW. I cannot use the main form's name
View 3 Replies
View Related
Feb 5, 2015
I have Main Form is named MainFrm and it has
two Sub Forms :
- OrdersSubFrm
- DetSubFrm
I want :
if OrdersSubFrm is not contains any records DetSubFrm is not enabled
View 7 Replies
View Related
Jul 19, 2015
In my DB i would like to make a form that displays different calculated values based on other forms and queries like income running cost etc., but i do not know how to refer in an unbound control to value of a control in another form. I get always #names? error. However it worked when loaded that form i refered to. Is there a way to do it without loading the refered form?
View 3 Replies
View Related
Mar 20, 2014
I have searched to find the correct syntax to refer to a combo box control on a nested subform. All the examples I've found Access 2013 will not recognize or find the appropriate control.
I have a parent form called IncidentDetails. On that form I have a control called ctrlLogDetail. Within that control is a form called sfrm_LogDetail. On sfrm_LogDetail, I have a control called ctrlType which houses a form called sfrmType. On sfrmType, I have a combo box called cboType. I need to be able to place the cboType choice into a query to filter records for another combo box on that same form. the query works appropriately when I have sfrmType open, however as soon as I try to call the query from the IncidentDetails form, Access cannot find the cboType control.
I've tried multiple variations of the syntax to call to cboType that I've found online. I found a very useful reference from BTA Development: however the syntax there will NOT work in Access 2013.
What is the appropriate syntax would be to get to my control within my 3 deep nested subform? I'm working Access 2013 and won't have a choice regarding Access versions.
View 5 Replies
View Related
Dec 20, 2005
Hi,
Just wondered if someone could help me with this prob?
The following text appears in a text box on a report
=[HirerCurrHouseNo] & " " & [HirerCurrAddress1] & Chr(13) & Chr(10) & [HirerCurrAddress2] & Chr(13) & Chr(10) & [HirerCurrTown] & Chr(13) & Chr(10) & [HirerCurrPostcode]
My prob is that if say "Address line2" is blank, I get horrible blank line in address (which looks rubbish when pirnting a letter!). What I would really like to do is move the lines up so they show as a proper address..
eg
Mr Joe Bloggs
29 The Street
Anytown
HD11AG
Not
Mr Joe Bloggs
29 The Street
Anytown
HD11AG
Thanks - And Merry Xmas!
View 1 Replies
View Related
Sep 30, 2006
Hello,
I have a query ... i hope that you can help me solve it!
I am creating a database where i was the ID to be concatenated from 3 fields. I did that well i think i did but when i save the concatenation of the ID is not saved in the table .. :confused:
In the ID field in the form i added this in its control source [ =[Field1] & "" & [Field2] & "" & [Field3] ]
.. In the form it concatenated fine but in the table all the fields are saved except for the ID ... :rolleyes:
Help please!
View 2 Replies
View Related
Mar 27, 2005
H ow to concatenate the records of a single field with iteself
forexample
invoice no:
1
2
3
4
5
...
i want it to be written as
1,2,3,4,5,6
can it be done
can i concatenate records with each other of the same field.
View 3 Replies
View Related
Mar 8, 2006
I have a table that I need to query that looks something like this:
ID Type Product ID
123 Health 323
123 Health 424
123 Dental 424
124 Health 323
125 Dental 323
What I need to see is something like this:
ID Type Product ID
123 Health 323 + 424
123 Dental 424
124 Health 323
125 Dental 323
In other words, I need to have the Product ID field concatenate for like ID and Type. I know it would likely involve writing some code but I am a total beginner in that respect and I don't know where to even begin. I could really use some help. Of course I need this as soon as possible! :(
To make matters worse (well, maybe it does), I am using Access 97.
Thanks so much!!!
View 4 Replies
View Related
Jul 26, 2007
Hey everyone,
Well i've searched, and have been trying to use 'fConcatenateFldGroupBy' in a query in order to perform the following combining of data with a criteria requirement...
All data is in one table: (frequently re-imported, so no relationships)
Obviously data needs to be stored more efficiently, but I have no control over the imported data structure. Here is what I'm after:
Table structure:
ID - Name - Status - Comments
1120 - One - Pass - uniquecomment1
1120 - One - Fail - uniquecomment2
1120 - One - WIP - uniquecomment3
345 - Two - Pass - uniquecomment5
345 - Two - WIP - uniquecomment6
Need a query to format data as:
ID - Name - Status - Comments
1120 - One - Fail - uniquecomment1, 2, 3...
345 - Two - WIP - uniquecomment5, 6..
As you can see comments need to be concatenated with commas seperating them.
As for the Status determination, it needs to be determined for the ID based on certain conditions. If at least 1 is fail, all fail. Iff all pass, all pass. If no fails and 1 wip, WIP, etc.
I have wasted too many hours trying to figure this out on my own, so I'm seeking your help! Any input would be appreciated. Thank you.
View 7 Replies
View Related
Aug 18, 2006
Please can anyone give me a piece of code to combine the text from memo fields in 25 different queries and put it in one text box for printing?
Thanks.
View 2 Replies
View Related
Aug 22, 2006
I have some data and I want produce a summary report. The trouble is that I need to combine F2 in to one value. AggOfF2 is produced by taking the distinct values for F2 in the group, and concatenating them together with a "/" seperating each element. I don't believe there is a built in function to do what I want, but can I create a function in VB? If so, how?
SOURCE
F1 F2 AMT
1 A 1
1 A 1
1 B 1
2 C 1
3 D 1
SELECT F1, AggFunc(F2) AS AggOfF2, SUM(AMT) as SumOfAmt
FROM SOURCE GROUP BY F1;
SUMMARY
F1 AggOfF2 SumOfAMT
1 A/B 3
2 C 1
3 D 1
Thanks,
David
View 4 Replies
View Related
Sep 10, 2006
Can anyone please give me an Access 2000 VB module that will concatenate [Portia - 1 query.text1] with [Portia - 1 query.text2] and type the result in textbox [Alltext]? Thanks.
View 1 Replies
View Related
Apr 29, 2005
I have a Main form with two subforms Sub1 and Sub2.
I want to set the RecordSource of Sub2 from the OnGotfocus event on Control1 on Sub1.
My code is:
Dim intCtrl as integer
Dim strSQL as string
intCtrl = Me.Control1
strSQL = "Select * from MyTable where Id = " & intCtrl
Forms!Main!Form!Sub2.RecordSource = strSQL
Forms!Main!Form!Sub2.RecordSource.ReQuery
When Control1 gets the focus I get an error Runtime error 2465 Access can't find the field 'Form' referred in your expression.
Have tried many permutations but no luck.
Grateful for help.
View 1 Replies
View Related
Sep 25, 2005
I have a main report which has a subreport. On the main report I have txt fields that I want to change their background colors based off values in fields on the sub report.
Thanks
Jon
View 1 Replies
View Related
Sep 17, 2007
Hi everyone!
I'm working on creating a small database for the company I work at and just can't figure out the syntax to make this work.
If I create a query that looks for clients Like '*Smith*' , it returns records where the client is John Smith, Smith and Company, Edward Smith & Jones, LLC and that part works great! I did this by typing: Like '*Smith*' in the criteria field for Client in the design view of the query. (Also seems to work whether I use single or double quotes - not sure about the implications of that).
Now, I want to replace the word Smith with whatever a user enters into a text box, I can't get the syntax right! In the design view of the query, I've tried things such as: Like '*forms![Search by Client]![Text0]*' with no luck. Any ideas? Maybe I'm missing some brackets or parenthesis?
View 3 Replies
View Related
Feb 10, 2005
I have a form with 25 related sets of text-box controls:
Product1, ProdDescr1, ProdQty1
Product2, ProdDescr2, ProdQty2
... Product25, ProdDescr25, ProdQty25
I need to loop through all 25 to check that the ProdQty for each is correct, and if any of them are incorrect, I'd like to set the BackColor to Red and the ForeColor to White for that particular set of controls. Rather than coding all 25 checks, I'd like to use variables to loop through the 25 sets
I understand how to create an incrementing Integer variable, but what is the correct syntax for combining that Integer variable with the String variables in order to perform the Back/Fore color commands?
View 2 Replies
View Related
Feb 13, 2005
Hi All!
Well I got a problem and guessing this is possible to do like this but well after few hours and staying at the same point maybe some help can be greet
I have a database witch I have 2 important field and a command for this. A field called ID with a number and another called GenerationID who contain number between 1 to 12 depending of which generation is. I got this Generation ID from a subform. What I want is this:
Depending of the number in generationID field show a different button like ID3 with generationID = 3 or ID2 if generationID = 2 etc until 12 and then other command buttn is not visible.
I don t know how to put the code but the code probably look at this:
If generationID = 3 Then
ID1.Visible = False
ID2.Visible = False
ID3.Visible = True
Else If
generationID = 2 Then
ID1.Visible = False
ID2.Visible = True
Id3.Visible = False
End If
End If
or if you have a better way all is welcome.
View 4 Replies
View Related
Mar 10, 2005
How can i refered to a table value through a form?
Thank you!
View 5 Replies
View Related
Oct 11, 2005
Hey everyone
This issue is holding me back now on 2 areas of my project :(
I need to know correctly how to reference a subform in a query.
Can someone please give me a working example for this:
main form: training courses
sub form control: course_dates subform control
sub form: course_dates subform
text box: course_date
I have tried:
[forms]![training courses]![course_dates subform control]![course_dates subform]![course date]
in the criteria box, but every time the query runs i get a parameter box "forms!training courses!course_dates subform control!course_dates subform!course date" asking for the info.
Seriously I am totally stuck on this and i think all i need is one perfect example... please help!!!
View 3 Replies
View Related