473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Temporary fields in a query

I have large table from which I need to select some records based on options given by the user in a form. Filtering the table is no problem but the filtered records (around 300) need additional temporary fields. These fields will initially be set to the same value but the user needs the option of adjusting the fields for each record.

I started to program this by creating a temporary table, getting the user input and then copying across the records I need before finally updating the two additional fields with defaults:

DoCmd.RunSQL "INSERT INTO Rtmp SELECT DNI FROM Slst WHERE Est <10"
DoCmd.RunSQL "UPDATE Rtmp SET [score]= '" & Me.Score & "', [Res]=" & Me.Res

The final table is then presented in a form for the user to review and edit (only the two additional fields can be edited) before it is exported to a text file and the table is deleted. The text file is used by another program for further processing.

It works but I was wondering if there is a more elegant solution..
Feb 23 '10 #1
5 5189
hedges98
109 100+
I'm probably wrong but, couldn't you do this using queries/subqueries?
Feb 23 '10 #2
hi Hedges98, could you pls elaborate?

My form takes input which is used to select the records from the main list. I am not sure how I can pass that input to the query- not familiar with that.

Also, where would I hold the two additional and temporary fields for each record selected?

I was thinking I could simply add two extra fields to the entire database and then just filter but filter list will be 200-300 and the main table is 2000+.

Sorry if I am missing an obvious point- quite new to Access programming.
Feb 23 '10 #3
hedges98
109 100+
Could you post your table structures? I can help further if I can see them (well, I'll try, I'm no expert myself!)

You can create a query that will take the selection from the combo box on your form and filter the results (along with creating the new fields you require).

From this you can either choose to display these results on the form - although this would be a bit of a mess if the results returns a lot of results OR you can create a report/possibly output it to word then from here your users could edit the new fields?
Feb 23 '10 #4
The master table has 20 fields and the form uses 6 fields from this table.

One of the 6 fields is used to filter the master table based on a dropdown option on the form

Only 3 of the 6 are displayed, the filter field is only used to filter, and the remaining 2 are exported to a txt file along with the two temporary fields created in the form.

The user needs to review the values displayed, edit the two additional values where necessary and the a VBA routine exports the 4 fields (2 invisible fields + the 2 temporary ones) to a txt file.

The txt file must follow a strict fixed field format to be read correctly by the other system, so having the user edit this will almost certainly generate errors.

I think I can see how to program the query but I dont know how to add the two temporary fields to the query or see where the data would be stored without a temporary table.
Feb 23 '10 #5
hedges98
109 100+
So when you filter the table, are the filtered results displayed on the form at present? How? As a datasheet? I'm confused as to how users view the filtered information...

Also, I think you're right about not being able to create the two new fields in a query without doing a make-table query (which I have no experience of) and I think what you have basically does the same thing anyway.
Feb 23 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Didier ROS | last post by:
Hi, I am a newbie I want to create a temporary table and I get the following error message : mysql> CREATE TEMPORARY TABLE tempemp AS SELECT * FROM emp; ERROR 1044: Access denied for user:...
1
by: Omavlana | last post by:
Hi, How can I create a temporary table say "Tblabc" with column fields ShmCoy char(2) ShmAcno char(10) ShmName1 varchar(60) ShmName2 varchar(60) and fill the table from the data extracted...
2
by: Ryan | last post by:
Just a quicky about temporarary tables. If using QA, when you create a temporary table, it gets dropped if you close the query. Otherwise you need to state 'DROP TABLE myTable' so that you can...
2
by: airkart | last post by:
Hello, I've scoured groups and the web, and haven't found a question like mine answered. I'm using Visual Studio 2003 with the Crystal Reports it comes bundled with and SQL Server 2000....
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
11
by: Hemant Shah | last post by:
Folks, I have a perl script that creates and uses global termporary table. This script worked fine with UDB 7.2 on AIX. Sometime ago I moved the database to UDB 8 on Linux. The select statement...
3
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these...
3
by: aligoli | last post by:
hi ! I am a new programer by VBA and know I can't use the fields of a query . my codes are as below : Dim mydb As Database Dim str1 As String Dim rsttemp As Recordset Dim qdftemp As QueryDef ...
4
by: sandeep.iitk | last post by:
Hi, One query is failing on the database and its a long query which was running fine earlier. One possible reason we can think of is increase in data in tables in query. It is failing with...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.