Saving SQL Created On The Fly As A Query

Mar 4, 2006

Hi...

I am relatively new to access.

I have spent a few days coding a database search page consisting of various comboboxes and textboxes. the user can select or enter data in these and when he/she clicks the search button an SQL select statement is generated on the fly and updates an existing query and this is used to query the database. I want to be able to give the user the option to save the query he/she generates and reuse it. How can I prompt him for a name and turn the SQL string strSQL that he has generated into a query and save it for later use?

Any help greatly appreciated..thanks

View Replies


ADVERTISEMENT

General :: Capturing And Saving User Name Who Created And Updated A Record

Jul 20, 2012

I have taken the Access Tasks template and modified a bit. It now captures and saves the time and date a record is modified. The database is on a network folder and is shared among our team users.What I would like to do next is make it,

1- capture and record on my Tasks table the user name of who created the record by using the fOSUserName() function. I have the table fields "Created by" and the VB code in a module. This would happen only once when the record is created.

I would also like to do this with the machine name for which I have the module too. fOSMachineName()

and,

2- capture and record the user name of who modified a record. For this I also have a field in my task table "Last Modified By" and i hope i can use the same fOSUerNmae() function.

I got to the point where I put an unbounded text box with the =fOSUserName() in it and it does show the user name but how do i get to record to my task table?how the template removes the tasks that are completed from the task list as soon as it is updated to completed? how can I make this happen with a cancelled option after I add it to the drop down list?

View 3 Replies View Related

Running An Automated Query Created In MSACCESS

Jul 20, 2006

Hello All,

I am new here and new to Access.

I have created a query which allows me to schedule daily events. But I want to automate this. Let me explain what i am trying to do.

Every morning at 7 am I want this query to run and the output of which to be mailed to myself. All this without me having to hit any button of sorts.

I have a long shot but very inefficient answer to this - which would be - having to leave my MS ACCESS running all night with an infinite loop checking to see what the system time is. When the infinite loop equates to 7 am it runs the query. But I think this would be a massive memory guzzler and I don't like this solution. Is there something else I can do?

Thanks for you time.

Regards

View 1 Replies View Related

Sequential Number Created By A Query URGENT

Jan 5, 2006

I am trying to create a sequential number field in a query. I cant use an auto number for the fact that i am combining multiple tables. Any help with this would be greatly appreciated.

View 14 Replies View Related

Forms :: Printing Report Created From A Query

Oct 2, 2014

I've created a form that prints a report created from a query.

I want the form to have two print options - to either print by Date OR Job # and I want the data pulled from the same query.

Right now I have the criteria setup in the query for the Date and Job # fields to:

DATE: [Forms]![Job Cost Form]![Text0]

JOB #: [Forms]![Job Cost Form]![Text1]

...It works if I only have one criteria setup, but does not work if I try both.

Is this possible??

View 2 Replies View Related

Queries :: Remove MsgBox Created From A Query

Sep 26, 2013

Here is the SQL from my Query

SELECT PreStatus.Operator, PreStatus.Mode, Sum(PreStatus.CountOfMode) AS SumOfCountOfMode, IIf([SumOfCountOfMode]>=3,"YES","NO") AS [Current], PreStatus.Rate, PreStatus.Last, PreStatus.First, PreStatus.DET
FROM PreStatus
GROUP BY PreStatus.Operator, PreStatus.Mode, IIf([SumOfCountOfMode]>=3,"YES","NO"), PreStatus.Rate, PreStatus.Last, PreStatus.First, PreStatus.DET
HAVING (((PreStatus.Rate) Like "*" & [Forms]![Status]![Rate] & "*") AND ((PreStatus.Last) Like "*" & [Forms]![Status]![Last] & "*") AND ((PreStatus.First) Like "*" & [Forms]![Status]![First] & "*") AND ((PreStatus.DET) Like "*" & [Forms]![Status]![DET] & "*"))
ORDER BY PreStatus.Operator;

When I run Query a dialog box request for SumOfCountOfMode appears. Is there anyway I can turn this MsgBox off?This Database is used for the user to find out if their personel are current in said data. The user will be running this query through a Form and will get their results via a report if they put anything in this MsgBox it could possibly skew the data they are looking for.

View 3 Replies View Related

Modules & VBA :: Create And Open Variable Folders With Link Created In Access Query

Aug 5, 2014

I am trying to set up something to be able to take me to a folder that holds various forms for personnel. I have a query that generates the link for each person. I have tried to set it up as a hyperlink in ACCESS 2013 and it displays as one but doesn't act like one.

I want to be able to click the link and have it open up a personnel folder for that individual. I can't find a MACRO that I can create to do it. Example of my query is that it creates a link K:Main BreakdownSection BreakdownPersonnel FoldersName and the name is the variable part.

My next problem will be to have it create that folder when we have new personnel arriving.

I would also note that I have not worked with ACCESS in many years and much of what I was able to do with 2002 and 2003 doesn't work with the newer versions of ACCESS.

View 3 Replies View Related

Saving A Query For Export

Jun 14, 2005

Oper sys is XP. Office 2000 version of Access. Extensive experience with Excel but very little with Access.

I'm creating an astronomical database that includes a function that calculates the distance to galaxies in millions of light years. These databases are massive. Total database has about 1.6 million galaxies (100 Meg). My query concerns about 500,000 of these.

Have the original database and done the query on the objects of interest. It includes the cacluations. All perfect.

Now, it is possible to save just the query so that I can copy it onto a CD and take to the observatory for field reference. Query has about 500,000 lines, one for each galaxy, but is only six columns wide. But at 500k lines it cannot be exported into Excel. Or at least I don't know how to do that.

Thanks for your assistance

View 2 Replies View Related

Problems Saving A Query

Apr 28, 2006

Hi there

I've got an access file which was probably created with access 97 or 2000, and inside a query that I know for a fact works with SQL Server 7

I was upgrading to SQL Server 8 and I needed to modify that query because it didn't work with the new version.
Now, when I tried to save the query, it gave me a certain error about invalid JOIN statements.
The query I wrote runs perfectly when I try to execute it manually on the SQL server, but MS Access just won't allow me to save it!

Any ideas how I can make it save my new query without it trying to verify my SQL statement?

Thanks

View 3 Replies View Related

Problems Saving A Query

Apr 28, 2006

Hi there

I've got an access file which was probably created with access 97 or 2000, and inside a query that I know for a fact works with SQL Server 7

I was upgrading to SQL Server 8 and I needed to modify that query because it didn't work with the new version.
Now, when I tried to save the query, it gave me a certain error about invalid JOIN statements.
The query I wrote runs perfectly when I try to execute it manually on the SQL server, but MS Access just won't allow me to save it!

Any ideas how I can make it save my new query without it trying to verify my SQL statement?

Thanks

View 3 Replies View Related

Saving Crosstab Query Results??

Jun 23, 2005

Does anyone know how I can save the results of my crosstab query into a new table (like a Make Table query does)?

Any help would be greatly appreciated!

View 2 Replies View Related

Saving Query Data Into Table

Mar 18, 2008

Ive created a query that asks the user to enter data (month and year) before it can be processed. This is causing a problem for me as i need to produce a chart from this data and access isnt letting me (access doesnt like me asking the user to enter data). So i thought if the data could be stored in a table then the chart could be drawn from the table.is this possible.Below is a screengrab of the design view fro the query.

http://i30.photobucket.com/albums/c329/oohmygod831/screengrab-1.jpg

and this is the sql for the query

SELECT Shift.Shift_ID, Shift.Shift_Type, Sum(Main.Shift) AS SumOfShift, Format([Date],"mmmm") AS Expr3, Year([Date]) AS Expr4
FROM Shift INNER JOIN Main ON Shift.Shift_ID = Main.Shift
WHERE (((Month([date]))=[Month]) AND ((Year([date]))=[Year]))
GROUP BY Shift.Shift_ID, Shift.Shift_Type, Format([Date],"mmmm"), Year([Date]);

View 2 Replies View Related

Saving Record To Run Query & Update

Jun 14, 2005

Hi all,

I've got this form working ok but need to add some extra functionality but haven't a clue how to do it!

http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=10175

The uploaded database has two main forms. The first is used to enter customer data, the second runs from a query and shows all those records that have been completed in the first form (frmCustInfo - AgentLog = Yes) but not completed in the second form (frmControlsSource - AnalystLog = No)

Then more data is input into one of the subforms (frmControlChecks). Now in order for me to see the results of the queries connected to two other subforms I have to move off the record and back to it (for the record to be saved and then the queries run)

After moving back to the record, the query results on the right (Information Only) are manually added to the last subform 'Input Two', then the user would move on to the next record and do the same.
-------------------------------------------------------------------------------------------------------------
What I need it to do then is this: When the user tabs off the last field in the subform (frmControlChecks), the queries to the right (two subforms) would run, showing the results and also populating the last subform (frmAnalystInput)

The user would then click AnalystLog and move to the next record.

I hope this is possible without redoing the forms/queries because it's taken ages to get this far

I've also added info in this sample database and some working data if you want to take a look...thanks for any help

View 1 Replies View Related

Saving Query As Filtered Result Set

Jun 21, 2006

I have created a query of 382 records. After filtering I now have a result set of 32 records, which I want to save as another query.

When I select Save As and rename, I get my original 382 record query with a new name.

How do I save the 32 record result set?

View 1 Replies View Related

Queries :: Saving A Working Query

May 21, 2013

I have an simple Access 2001 database with one table in which I want to search multiple fields for entries which match upto four keywords using subqueries.I have entered the following sql code:

SELECT Components.[Component-type], Components.Value
FROM (SELECT Components.[Component-type], Components.Value
FROM (SELECT Components.[Component-type], Components.Value
FROM (SELECT Components.[Component-type], Components.Value
FROM Components

[code]....

and then refuses to save it giving the error: "Invalid bracketing of name 'SELECT Components.[Component-type"If I remove the changes it will save ok. This is only a test query as I will want to add many more fields and it is my first use of sql code.

View 8 Replies View Related

Changing The Name Of The Created Table In A Make-Table Query

Sep 23, 2007

Dear Access Expert

I wanted to know if it is possible to change the name of the Table which is going to be created using a Make-Table Query via code (VBA).

For example if my Make-Table query currently creates a table with the name "Table1" I want to change it to name "Table2" and then change it Back to "Table1" or "Table3" etc.... depending on the users selection.

View 6 Replies View Related

Forms :: Saving Selection From Listboxes To A Query

Aug 20, 2014

I am new to Access and I have get to where the users can make selections in the listboxes, but then I need to save the selection in a query or table to save thier changes.

View 1 Replies View Related

Adding / Removing And Saving Existing Query

Jan 28, 2013

I am in the process of making a database and basically I have everything done but this saving, loading and adding/removing part.

Would it be possible for me to allow end-users to run queries that they could save, load, add to the existing table or remove from the existing table?

When I say Add/Remove what I mean is could a user of the database run a search of every customer in the state and then remove everyone in County X or on the other hand could they run a search of every customer in the state and then add every customer in a neighboring state.

Kinda like layers and again I have all of the criteria set up I just need the Save, Load and Add/Remove buttons on the form. I should add that I do not want users to save over the main table I want them to save it as there own text file they can upload later.

View 14 Replies View Related

Saving Value To Variable? (update/make Table Query)

Aug 28, 2007

I am trying to create a table to show the parent/child relationships between assemblies, sub-assemblies and detail parts. The table I start with has 2 fields a "Part Number" and an "Indenture".

Please forgive all the periods, couldnt think of how else to seperate the values to depict the tables.

Example:
IND..PN
00....A
01....B
01....C
02....D
03....E
03....F
01....G
00....H
01....I
02....J

I can get the first step to completeing the new table of parent/child relationship like this:

PN....00....01....02....03
.A.....A
.B....."".....B
C......"".....C
D......"".....""......D
E......"".....""......"".....E
F......"".....""......"".....F
G......"".....""......""....G
H......H
I......""......I
J......"".....""......J

Where "" are null values

My problem is making it so that every part number has its own array, aka [family tree], so that for part "F" the table would hold "A,C,D,F"

I though an update query where for example:
*"Zero" is a single field string.

IIF([00]<>null(), Save [00] to Zero, Write Zero to [00])

Would work but have been unable to find any information about passing a field value to a variable for later use or comparison. I would have already done this in excel if the table had less that 65000 records.


Example of final table:

PN....00....01....02....03
.A.....A
.B.....A.....B
C......A.....C
D......A.....C......D
E......A.....C......D.....E
F......A.....C......D.....F
G......A.....C......D....G
H......H
I.......H......I
J.......H......I......J

Any help is greatly appreciated.
BsK

View 1 Replies View Related

Queries :: Close Query Without Saving Layout Change?

Jun 5, 2013

I have a form with a child that holds a query and for 99.9% of the time remains locked as it's for viewing data only. However, if the user wishes to make a change then they need to press an unlock button first then make the changes.

The problem I have is when closing the form; if this child's query has been unlocked I'm getting a message asking do I wish to save the changes to the layout of the child's query. The answer will always be "No".

I've added the following line of code to all sorts of procedures with no success.

DoCmd.Close acQuery, "LinkTableManager_Frmqry", acSaveNo

how to stop the message appearing when the form is closed.

View 5 Replies View Related

Saving Daily Generated Query For Later Lookup By Date?

Feb 26, 2014

I have a query that reports the number of students that are currently enrolled in a given number of schools within an area for that given day that the query is ran. This number can fluctuate greatly day to day, so is there a way to create a table which can hold this information so that I can go back in history and look up what our numbers were on whatever given day (date). (The example below is just a representation of what I actually have.) The School number would be unique, as would the date (I assume), I would like to see all of our school on whatever given date to see what our numbers are or were.

I have an example of the query currently I have set up in access 2007:

School # School Name Qty Date
001 BLUE 300 02/26/2014
002 RED 468 02/26/2014
003 YELLOW 10 02/26/2014

VS

School # School Name Qty Date
001 BLUE 310 02/27/2014
002 RED 400 02/27/2014
003 YELLOW 8 02/27/2014

View 3 Replies View Related

Forms :: Open A Form For Saving Results Of Query To A Text File On Desktop

May 6, 2015

I have a BE database, that when opened, opens a form for saving the results of a query to a text file on the desktop. It works fine, if the full path is entered.

The problem is, I want this saved on any users' desktop. I did some digging and found the %userprofile% variable, which when used, gives me the error.

I understand this should work in both Windows XP and Windows 7, which are the environments the full DB will operate in. So far the "EXPORT" button on the form has the following for the code:

Code:
Private Sub BTN_Export_Click()
DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", "C:UsersMark N. McAllisterDesktopPubComExp.txt"
End Sub

When I tried this:

Code:
Private Sub BTN_Export_Click()
Dim strPath As String
strPath ="%userprofile%desktopPubComExp.txt"
DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", strPath
End Sub

the error occurs.

View 10 Replies View Related

How Do I Get The Newly Created Key?

Jun 27, 2007

I have tables which I add a new post to. But I want to find its key. DoCmd.GoToRecord , , acNewRec
'Lot of data fills out the different textboxes
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Requery
When I first save the data and the requery the you should expect the ID field on form to have the new unique number but it doesnt. Can you get the current unique ID on some other way?

View 2 Replies View Related

New Files Being Created

Nov 27, 2007

I have created an Access 2007 database on a network drive. I notice that as the database is being used, other files are being created sequencially such as, "database1", "database2", "database3", etc. What are these files. They are quite large and I am wondering if they are necessary.
If anyone has any information, I would appreciate it.

thanks,

View 5 Replies View Related

Synopsis - After A DB Is Created

Mar 27, 2008

I am trying to understand what’s next after a database is created (meaning it is functioning, but not ready for multi-user environment and not secured yet). By reading various postings and some articles, it seems these are the key steps I need to follow in order to have a database ready to go.
1. Once the database is ready and tested (at this point I am the only user and have full privileges to the database), I need to do the split – front end/back end (by using Access split wizard).
2. Then I save the back end on a shared drive to which the respective users will have access.
3. Next I secure the back end.
4. Then I create users group(s), and assign user ID/password for every user.
5. I install the front end to every user’s PC so they can begin to use it (not sure how to do that - some help is appreciated here!)

Is this close to what the process would be (even very oversimplified) or I am too far from the truth?! :confused:

Thank you in advance!
Atol

View 6 Replies View Related

Should Forms Always Be Created From Queries

Jul 1, 2005

I've read quite a few posts and noticed that quite a few people have said that forms should be created from queries. Is this personal preference or a must.

Like I said on a previous post I am going on a one day Access soon, so maybe I should stop reading and playing until I have completed that, but my mind is running away with what I want to do.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved