Concatenation Module
Aug 18, 2006Please 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.
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.
I'm wondering how other members here make decisions whether they want to place codes behind form or use a standard module instead.
I understand there is a performance penalty when you add another module (and use it), but am not sure whether one big fat module would be faster than several smaller modules with identical coding.
Furthermore, I know that some members use a hidden form to deal with startup and shutdown processing. Sometimes the processing has nothing to do with forms and would make more sense in a standard module, but since the form is already loaded, does it makes more sense to use the module behind the form than calling a function in a separate standard module to execute the needed code?
So, what do you tend to do in such situation?
I am creating an form in a database and whenever one of my procedure's run it creates this error message:
The expression ON Load you entered as the event property setting produced the following error:
Member already exists in an object module from which this object module derives.
*The expression may not result in the name of a macro, the name of a user-defined function, or [event Procedure].
*There may have been an error evaluating the function, event, or macro.
An ideas?
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!
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!
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.
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.
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
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!!!
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.
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
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?
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 Relatedknow 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 6 Replies View RelatedHi, I hope someone can help. I know there are masses of threads on security but I can't find one that is similar to my problem.
I have a SQL 2005 database that uses an access front end AND an intranet front end, dependent on the user.
I need to write a security module to run both so that whether a user is on the access version or the intranet version the security will remain the same. The security will be maintained from within forms in access.
Has anyone done something similar or seen any articles on something like this that will help me.
Many thanks
:confused:
I am in Acess2000 and trying to go to put vb in. When I hit the code icon,
I get the message: "name of db" failed to create the VB module '|'.
Is anyone familiar with this message and what do I need to do. I just added this form, and in the other forms that have vb code already, I can get to them okay.
Thanks in advance for your help.
I have a bunch of Forms set up in Access that are updating tables etc......
At present 100% of the code is sitting on the Form. I have some code that is repeated because of a string parsing issue. What I am thinking of doing is writing this code as a couple modules and then call them when needed.
Does that make sense to write them as modules and call them?
How do you call a module???
Thanks
Hello,
I have created menu bars for my access application and now would like to transfer many pieces of code in modules so that they can run using macros. I beleive this is the only way I can make run my code from the menu bar. Correct?
I am having problems with the modules since I have never used them and would like some help.
Here is a sample of code I now have on a push button in a form:
Dim mydb As DAO.Database, MyRs As DAO.Recordset
Dim strCode As String
Dim strFilter As String
Dim stDocName As String
Dim stLinkCriteria As String
Set mydb = CurrentDb
Set MyRs = mydb.OpenRecordset("master")
stDocName = "MASTER"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
If Not IsNull(DLookup("[SSN]", "TEMPLATES", "[SSN] = '" & Me!SSN & "'")) Then
Forms("EFORMS").Visible = False
Else
If IsNull(DLookup("[SSN]", "TEMPLATES", "[SSN] = '" & Me!SSN & "'")) Then
DoCmd.OpenQuery ("Appendtemplates")
End If
End If
If Not IsNull(DLookup("[SSN]", "195", "[SSN] = '" & Me!SSN & "'")) Then
Forms("EFORMS").Visible = False
Else
If IsNull(DLookup("[SSN]", "195", "[SSN] = '" & Me!SSN & "'")) Then
DoCmd.OpenQuery ("Append195")
End If
End If
If Not IsNull(DLookup("[SSN]", "795", "[SSN] = '" & Me!SSN & "'")) Then
Forms("EFORMS").Visible = False
Else
If IsNull(DLookup("[SSN]", "795", "[SSN] = '" & Me!SSN & "'")) Then
DoCmd.OpenQuery ("Append795")
End If
End If
If Not IsNull(DLookup("[SSN]", "21", "[SSN] = '" & Me!SSN & "'")) Then
Forms("EFORMS").Visible = False
Else
If IsNull(DLookup("[SSN]", "21", "[SSN] = '" & Me!SSN & "'")) Then
DoCmd.OpenQuery ("Appendssa21tax")
End If
End If
Forms!eforms.lstPreInterview.Value = Null
DoCmd.Close
DoCmd.OpenForm ("Eforms")
DoCmd.RunMacro ("CloseEforms")
DoCmd.OpenForm ("Eforms")
End Sub
What I need is to add this code to a module, and make it run using a manu bar (I assume via macro). Thanks.
I was doing a compact and repair when I got this error message.
Now when I try to open my database all I get is this message:
"Module not found"
:eek:
Am I screwed or is there maybe possible silver bullet??
Thanks for any help
Hi,
My mainform, which controls virtually all operations, has dissappeared.
Since itīs supposed to load when starting the database, the form actually loads, but you canīt see it in the forms window.
when I try to edit the code I get the message "module not found".
What do I do?
Thanks
Fuga.
hello all
i need a small thing to change in a module but am not too familiar with vb so i reached a dead end, here's the story:
i have a 'dog pedigree' database that i was working on, now there's a report where a dog's parents, their parents, and their parents need to be shown
that turned out to be out of my league so i paid a guy to do it for me, it worked except he didn't do exactly what's need and i can't get to him now :S
anyway, in the report page,
you can notice that the name of each parent is shown, but i want the registration number of the parents to show as well,
i tried modifying the module but it didn't work (am not a vb user), so can anyone help me add the reg number to the name of the parents?
also, in the report, the dog's color is appearing as a number instead of an actual color so if that can be fixed as well ...
to understand better:
record 1 in dogs, click the preview diploma button
you'll notice "tat" as dogname and "ry245" below that as registration number
now sire is "pat" and dam is "titu", i want their registration numbers to show as well (and same for the rest of the parents)
i uploaded the file here for a closer look:
http://www.designcrafts.org/dogs1.zip
thanks :)
Hi
I how such code:
Public Function fConList()
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim strSQL As String
Dim strText As String
strSQL = "SELECT Contact.To FROM Contact" '
Set DB = CurrentDb
'Open a Recordset and loop through it to fill the text box txtTest
Set RS = DB.OpenRecordset(strSQL, dbOpenForwardOnly)
How to put some other query given by name to instead of putting sql directly into string?
I have also textfield that has this =fConList() as source.
Is it possible that i will have some combo box or list of queries and one button. When i press this button the name of the query in the function will change to the chosen One from the list.
Any Ideas?
i'm beginner so,
Thanks in Advance for some examples
I have created a query that includes a module that determine what the actual order date should be. This works correctly. Now, I want to take that date in another query to only show rows where RPODate exceed the recommended date.
I keep getting an error stating the query is to complex. If I run it without the >Checkdate in the criteriea for RPODate it's fine.
Any ideas?
Query 1 with module
SELECT qryInstallationRPOrdered.ProjectID, qryInstallationRPOrdered.Phase, qryInstallationRPOrdered.Unit, qryInstallationRPOrdered.Tract, qryInstallationRPOrdered.Release, qryInstallationRPOrdered.DelDate, qryInstallationRPOrdered.InstallDate, qryInstallationRPOrdered.State, qryInstallationRPOrdered.RPODate, qryInstallationRPOrdered.NVDate AS CheckDate
FROM qryInstallationRPOrdered
WHERE (((qryInstallationRPOrdered.State)="NV"));
Query 2
SELECT qryInstallationRPONV.ProjectID, qryInstallationRPONV.Phase, qryInstallationRPONV.Unit, qryInstallationRPONV.Tract, qryInstallationRPONV.Release, qryInstallationRPONV.DelDate, qryInstallationRPONV.InstallDate, qryInstallationRPONV.State, qryInstallationRPONV.RPODate, qryInstallationRPONV.CheckDate
FROM qryInstallationRPONV
WHERE (((qryInstallationRPONV.CheckDate)>[RPODate]));
I've been using Access for a while now, to track some names, addresses, locations, etc. Recently, when I try to generate a report, I step through the field selection, etc, and when I get to the "sort" page, if I just keep going, it proceeds fine. If I select a field to sort on, however, I get the following message:
"The expression Before Update you entered as the event property setting produced the following error: The function you entered can't be used in this expression.
*The expression may not result in the mane of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro."
I don't think I've changed anything to do with the program, or any of its Office brethren. Can anybody give me some advice? The report is generally useless without the ability to sort/group.
Thanks, all.
How to run a module in the macro?
Which step can run a module.
There is only option to openmodule action.
Please clarify
Is the calling Form name or the event handler's sub name available in called module? I need it in order to determine the form's name as in [Forms]!someformname!some control.
View 7 Replies View Related