Modules & VBA :: Adding Queries To Groups In Particular Database
Dec 29, 2014
I have a number of groups in a particular database. These are based on the month that they relate to, but they are also split into four separate groups for each month. So for example, I will have four groups for November 2014:
November 2014 Raw Data (which contains linked tables in another database)
November 2014 (which contains the bulk of the queries that are used for processing)
November 2014 Reporting (which are the queries that are used for month end reporting - obviously)
November 2014 Misc (anything that doesn't fit into the above, although there are always queries in these groups)
Now, I have been using this database since 2012, so as you can imagine there are quite a significant number of groups. Adding queries to new groups for each new month is therefore starting to take a while by scrolling down to the bottom... Is there a way to do this by using VBA? It would save a bit of time each month.
View Replies
ADVERTISEMENT
Feb 27, 2015
Can I create a table in the back end of my database using VBA in the front end? My client is using this system and I can't easily go to their location. I need to create a table on the back end and have it available in the front end applications. My thought is to create a front end only for the purpose of updating the backend with this new table. My idea is now to have it open with a button for the user to click - this will add the table to the backend with the required fields, confirm the update was completed and then close. This app then would be trashed so it would not be run again. (Though I would put a check in the VBA that if the table existed, the user would get a message box and the coding stopped to avoid overwriting the existing file.)
And once the table is created, is there a way to programmatically link it to the front end. I will be providing a new front end with this update so I could add something in the new version.
View 10 Replies
View Related
Feb 17, 2015
The goal I am trying to accomplish using VBA within Access 2010 is to append/add certain records to another database (Customer Service) from my database (Client Request). I tried using a macro to append then update records in my database but there is a "lag" time as to when the information is updated in the 'Customer Service' database causing my updates not to occur.
Here is the SQL from my query:
INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description )
SELECT [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY,
[Code] ....
And here is how I "thought" I could fix it through Access VBA:
Function UpdateIssuesDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdateIssuesDatabase_OpenError
con.Open _
[Code] .....
I have highlighted where it is giving me the issue.
View 9 Replies
View Related
Aug 6, 2014
I need to add trim to all text boxes in my database. Any easier way than to add it to the afterupdate event of every text box or a complete list of all trims on buttons that save the records?
View 14 Replies
View Related
Sep 12, 2013
how do you loop through and insert selected data from a listbox on at a time?For example, lets say you have an insert statement that has a firstname, lastname, CarsID(foreign key) and address field. Lets say you had another table that has ID and CarsID(primary key) field. In the listbox, you have populated it with all the cars and they are selected.
Example:
INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','Honda')
INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','FORD')
View 2 Replies
View Related
Aug 20, 2015
I am trying to add extra validation in a sample db (done in A97 (converted to A2003)see attached.
I am attempting the following: Please not that the db has existing validation which I would like to keep (or change if advised) ...
Conditions:
1. Input into field "ID" must start with the letter P or p or R or r
2. If field "ID" starts with the letter P or p and field "Code" starts with the letter R or r, then a message stating that this combination is invalid should appear
3. If field "ID" starts with the letter R or r and field "Code" starts with the letter P or p, then a message stating that this combination is invalid should appear.
View 3 Replies
View Related
Jul 19, 2013
My challenge is to take about 200 boxes, all of which are stuffed with file folders, and to create a database of their contents. That's all well and good. I made a simple table that listed the record, the date, etc, but I ran into trouble fairly quickly when I came across a folder that had folders inside of it. Basically I need a way to represent the folder structure the way it is in the box that makes sense within Access. What I'm imagining is something like this:
Record 1
Record 2
Record Group:
- Record 1
- Record 2
Record 3
Record 4
More recently though, I'm wondering if don't need to make a whole new table for that set of data. I just don't know how to set up the relationship
View 8 Replies
View Related
Sep 30, 2006
Hi there,
I have this sports center database. Basically what I have is a appointments or "bookings" form which I want to be able to modify to be able to add / delete groups that want to book time in the sports center, whenever I try to do this though however the bookings fail to show up on frmcalendar_daily.
Anyone got any ideas or suggestions (i deleted the groups table / form, decided to start from scratch!)
Jon
View 1 Replies
View Related
May 28, 2014
In the access form I want to add a button with a special functionality.
After clicking "Select file" button special window should be open (or something else). It should give user a possibility of files locating (doc, pdf, rtf, txt ...).
After selecting the file and confirm the choice in the table "File_location" in database path to the file should be saved .
View 4 Replies
View Related
Mar 13, 2014
I have 26 different option groups all with numeric values set for YES , NO, and N/A.
I attempted code to have the code read if the frame values were 1 Or 3 for all frames then a text field would read as "Pass" or it would be "Fail" but its not working. How to link all the options groups so that if YES or N/A have been selected then it will generate a PASS but if any of them selected NO it will be a FAIL.
View 3 Replies
View Related
May 12, 2014
I have a series of records that I would like organised into groups.For example everyone with the surname Jones who lives in Wales and is between 18-30 years old.I would like a Combobox that has that group sorting visible in some way, possibly with colours.for Example if i had the records:
First Name Surname Country Age
Dave Jones Wales 24
Bob Jones England 28
Fred Jones Wales 19
Jim Jones Wales 22
Ian Jones England 29
Frank Smith Scotland 32
I would like a Combo box that shows the names Dave , Fred and Jim with a background colour of Red then Bob and Ian with a background colour of white and Frank with a background colour of blue.how I group (maybe you can add spaces between the names Dave , Fred & Jim and bob & Ian).
View 2 Replies
View Related
Jul 4, 2013
I have a table with two fields like this:
F1 F2
110 1
110 1
111 1
111 1
111 1
112 1
112 1
.....
I need to change the number in F2 like this
F1 F2
110 1
110 2
111 1
111 2
111 3
112 1
112 2
.....
View 5 Replies
View Related
Oct 14, 2013
I have a query that will sort groups of zip codes using the following expression: Between [T_ZipRange]![StartZip] And [T_ZipRange]![EndZip]. The first and last zip codes are entered and the expression returns the zip codes between the "start" and "end" range. The problem is that if a zip code is only 5 digits: xxxxx- instead of xxxxx-xxxxx, the zip code will show up in other sorts. The zip code field is a text field. How can I limit the sort, based on the number of digits in the zip code?
View 2 Replies
View Related
Mar 16, 2014
creating a query with a running sum (cumulative total) across two categories. I need to accumulate Wages by employee, by calendar year for every day/every job worked. I have a table containing over 33,000 records, the years span from 2009 to 2014 with multiple employees.
The Dsum option I have found on the internet is too time-consuming and locks up my query for the over 33,000 records I need to generate results for. It needs to be a SQL statement. Although all the SQL statement I have tried simply total all Wages for every entry ever made in the column, instead of per calendar year, per employee.
Here are my fields:
Calyear = Ascending
Employee Name = Ascending
WorkDate = Ascending
ID
[code]...
There may be more than one entry per day per employee in a given year. This is so I can calculate certain payroll taxes which are based on cumulative wages amounts.
View 4 Replies
View Related
May 18, 2013
I've a club database the records score for juniors on age groups that are set as of the 1st January each year. I would like to set this automatically from the date of birth. I have found some code that is very close to what I need apart from the fact it groups on the exact DOB resulting in changes to age group mid year.
'----------------------------Code Start--------------------------------
Public Function AgeGroup(dtmBirthDate As Date) As String
Dim intAge As Integer
'Age Calculation
intAge = DateDiff("yyyy", [dtmBirthDate], Now()) + _
Int(Format(Now(), "yyyy") < Format([dtmBirthDate], "yyyy"))
Select Case intAge
[code].....
View 4 Replies
View Related
May 8, 2014
I have a query that lists the total number of parts received by month. I would like to be able to compare those monthly totals with a rolling 12 month total. I've been able to get the rolling 12 month total, but I can only get it to work for one 12 month period.
Is there a way to get a 12 month total for each month? In other words for April, I would like a 12 month total of May 2013 through April 2014. For May, I would like a 12 month total of June 2013 through May 2014. Is that possible? If so, how would you go about doing it?
I have a field in my table titled REL_MONTH that shows a negative number for how many months ago something is (i.e. 00 = May, -1 = April, -2 = March).
View 2 Replies
View Related
Aug 12, 2013
I have built a query that lists all the members in a group aged 15 to 18. Now I need to build another query that counts a subsection of that group (the number who gained employment in the quarter) and express this as a percentage of the whole of the 15 - 18 group.
I presume I can use the original query to get the number of 15 - 18 year olds. I can write the query to calculate the subset of 15 - 18 year olds who gained employment, but how do I get the total numbers of the groups and express them as a percentage?
View 1 Replies
View Related
Feb 17, 2015
I am trying to do is to make a for loop to insert multiple text fields in on table.
Depending on the counter (Zaehler) it should insert that representing text field. for example if Zeahler is 1 it should input whatever is inside the text field KVP_Kfm1 if its 2 then it should input the textfield KVP_Kfm2 and so on. here is the code that I'm trying to work but sadly it wont.I believe that the mistake is that my syntax is wrong but i cant figure out what is right.
Code:
For Zaehler = 0 To (Forms!frmCMP!txtAuslaufjahr - Forms!frmCMP!txtAnlaufjahr)
SQL = "INSERT INTO tblLifecycle_Projektion(ID_Berichtstand, KVP_Kfm, KV P_technisch, AeJ, MoPf, skAe, MiBst, Sonstige_Effekte, " & _
"KVP_technisch_FTR, KVP_Kfm_FTR, AeJ_FTR, MoPf_FTR, sk Ae_FTR, Sonstige_Effekte_FTR, Jahr) VALUES " & _
[Code] ....
View 3 Replies
View Related
Mar 10, 2014
I have put together a VBA sub to run Outlook.Application to send a report to selected email addresses. A Table's records contain an email addresses as well as category for grouping purposes.
I use a "Create Table Query" to extract the selected email addresses from the table into a temporary table called "ETransferAddress" then "Set rst = CurrentDb.OpenRecordset("ETransferAddress")" then concatenate the email addresses separated with commas.
This works fine for small groups, but the service provider blocks them if the number of email addresses go into the hundreds.
What I need is to break the email addresses into sub groups and then create a series of emails all with the same Report, Subject and Content.
One way might be to create a series of loops to create a number of smaller tables but to string that lot together to achieve it is beyond me at present.
Here is my code to date"
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim strPath As String
Dim strFilter As String
Dim strFile As String
Dim rst As DAO.Recordset
'Create a table with selected addresses
[Code] .....
View 2 Replies
View Related
Jan 3, 2014
I have a query with about 7500 records that are grouped as follows and sorted by Mtr_Reading
ID Name Event_Start_Time _Hour, Mtr_Reading
2210 XYZ 7/15/2013 13:00 17 150
2210 XYZ 7/15/2013 13:00 14 143
2210 XYZ 7/15/2013 13:00 16 115
2210 XYZ 7/15/2013 13:00 15 110
2210 XYZ 7/15/2013 13:00 13 100
2210 XYZ 7/16/2013 12:00 12 100
2210 XYZ 7/16/2013 12:00 17 150
2210 XYZ 7/16/2013 12:00 14 147
2210 XYZ 7/16/2013 12:00 13 113
2210 XYZ 7/16/2013 12:00 18 110
2210 XYZ 7/16/2013 12:00 15 100
There are about 75 distinct sets of ID's and Names not shown here
The rows were sorted by the Mtr_Readings and we have to take the best four readings out of each group and average them. If a group has more than four rows then the top 4 are taken out and the balance is discarded. If the group has four rows or less all of the rows are taken.
I did try nested select statements and kept getting "invalid argument to function" exceptions.
View 14 Replies
View Related
Feb 18, 2014
I am trying to add calculations to queries based on columns in the query... it seems to randomly expect 'Expression' or 'Group by' as column types, and Im having to create 3 sets of queries following on from each other to de-dupe data and allow filters on calculated values.
Also I've got a function which turns a date into a quarterly cohort, e.g. Oct 2013 -> 20134. I use ot on a lot of dates. I created a VBA function, CohortQ used as follows in queries:
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 CohortQ([InputDate]))
In the VBA, InputDate is defined as a date
Code:
Function CohortQ(InputDate As Date) As Integer
If InputDate = 0 Then
CohortQ = 0
Exit Function
End If
[Code] .....
But when I run it on a date field, it gives me a data mismatch error. I can't step through as it's working on 600K rows.
If I put the function into the query,
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 Year([InputDate])*10+DatePart("q",[InputDate]))
it works.
View 3 Replies
View Related
Mar 1, 2006
Any help would be really appreciated...
I have a database in the database I have products customers orders etc.
In Products table I have productid price etc. I would like to create another table and this table should consist of all product parts for example.
ProductID x uses
metalnumber23
stone45
plasticnumber43
so all metalnumber23, stone45, plasticnumber43 will be in Parts (new table that i will create) when i am entering a productid to Product table for that productid i should be able to choose which parts from parts table that it uses.
so in the order table if i customer ordered productID x I should be able to see all the parts that ProductID needs in the parts Parts table. There will be maybe 2000 parts but ProductID x will use only 3 of them. And if I create a query lets say order from z date to y dates I should be able to see parts needed for those products ordered.
hope you guys understand and give me a head start i would really appreciete
View 2 Replies
View Related
Jun 12, 2006
Hi there, this is my first post, hopefully not too many more problems i will encounter whilst designing my database.Anyway I am trying to add some fotos to each of my records, but not having as much luck as i would like. In the tables, i have made the field OLE object. When i try to add the foto (about 97kb) jpg format, all it does is add a picture of the jpg icon on my field. If i double click on the icon my foto will open, but i wish to have the foto showing in my record. Anyone help me with any ideas? I am using access 2003
View 2 Replies
View Related
Jun 6, 2007
Hi there,
I have a bit of a dilemma here.
I have an old database, which is very comprehensive, filled with client names, addresses, and other information.
I have been given a new database, which is more relational and effectient, which splits the client addresses into a seperate table.
I need to add the old data to the new database - so is there a way of doing this whilst maintaining the links between the old addresses and the rest of the old data? What I don't want to have to do is end up going through 3000+ entries sorting out what new CompanyID I should assign...
Any thoughts?
Cheers
Hob
View 2 Replies
View Related
Sep 6, 2007
Hello
First let me apologize if I am being stupid, quite new to Access. I am trying to create a database with some pictures in it; I want to design a form that changes the image with each record, (Its for work they want a database of our employees info with a photo of each employee) reading though the help file it seams I need to add a bound image control, I have tried 2 different ways and am still getting the same problem, the first way I tried was to create a text field with the address off the photos (there are .jpg’s) and then add a bound image control on the form and link it to the field. Problem is this just displays the name of the file not the picture (e.g. as you go though the records it shows Mark.jpg, Simon,jpg, Louise.jpg….) I then tried to add a OLE field and add the files that way, if I click on add from file when creating the object I get the same problem just displays the file name, If I click create new bitmap image it works and displays the picture, the problem is the data base file then becomes huge (it was 45 meg with 2 photos, I need to add about 150 in total!. Am I being totaly dumb, is there a way of getting Access to display Jpg’s and ideally have them linked to instead of embedded to keep the size of the database down.
Sorry for rambling! (oh yeh and I am using Access 2003)
Thanks in advance!
Matt
View 2 Replies
View Related
Oct 11, 2005
Im trying to add 2 new tables to a split and linked database... but no matter which side i add the table to (BE or FE), it wont show up in the linked table manager.. so my question is 1.) is there some trick to getting it to show up in the link manager? or 2.) is there some way to re-merge the database, add the new tables.. and then split it again?
View 3 Replies
View Related