Build A Temporary Table
Apr 22, 2006hi
hi
i have sql query in a string
strQuery="...."
how to create temporary table with the result of this query?
thanks
hi
hi
i have sql query in a string
strQuery="...."
how to create temporary table with the result of this query?
thanks
I would like to create a "global" temp table that can be viewed by all users. The syntax is:
Create [TEMPORARY] TABLE tablename (field type)
QUESTION1:
When I put the optional [TEMPORARY] in, I get a syntax error...
Create [TEMPORARY] TABLE t (ID int)
I've tried...
Create TABLE [t] (ID int)
Is that the same as doing this???
Create TABLE t (ID int)
Can someone clear up my syntax?
QUESTION2:
If i can create a temp table when does the table go away? When I close access? Do I have to delete it?
Can someone clear this up? Thanks.
Hi there
I'm new to this so please be patient!
I have developed an Access database which produces financial reports based on a date range which the user specifys, taking the data from a SQL server. He chooses his dates and then runs a macro which creates the new tables, overwriting previous tables. Numerous financial reports run on these tables so I need to keep the table names the same.
The problem is that only one user can access the DB at anytime because the new user can't delete the other users table becuase it may be based on a different date range.
I'm open to suggestions but maybe what I need to so is create tables which are based on the user id when he logs in to the Access database so that he doesn't delete someone elses table. How can I do this please!!!???
Thanks in advance
Davebhoy
For my inventory DB, when creating a purchase order, I need to store all transaction in a temporary folder and give a temporary number to PO and after finalisation only all data should be appended to main po table with new po number that will be last+1. And all data from temporary tables should be deleted. Like an air ticket is generated, first checks all details, give seat location also and if "Committed" gives the final ticket with no
Any idea about structural configuration and type of queries to be used
Hey again.
Asked a question last time that might've been a little too complicated but I've made a lot of progress since then. :)
I've a form which I enter weekly data into which I have transferring into a temporary table. At the bottom of this form I've got a button which runs an update query which takes the entries from the temporary table and adds them to the main table.
(I'm doing a fantasy football league. An example is that if I enter that a player has recieved one yellow card in the weekly data, when I update the main table it will add one yellow card onto the total, etc.)
The problem I need help with is that I find that I need to get the temporary table to wipe itself as soon as I press the button to update the main table. Is there a way I can work it into the update query, or will it need to be done seperately?
Thanks.
(I have searched for this kind of thing, and found a topic that was dealing with VBA. From what was posted it didn't seem to relate to my problem, so I decided a new topic would be my best bet to get some help.)
I'm trying to put values into a temporary table for the user to view the work behind a returned calculated value.
Here is my code:
Code:
Sub SearchPartNumber_Entered()
Dim txtPartNumber As Variant
Dim rst As Recordset
Dim rstt As Recordset
Dim u As Variant
[code].....
How do I put all values under all 'u' 's into one table?
I want to store a query into a table, which I will delete later on. But somehow it shows me an error: Data type conversion error at the qdf = CreateTableDef assignment line.
Code:
Public Sub LF_Query()
Dim i As Integer
Dim strSQL As String
Dim qdf As TableDef
[Code] .....
I'm making a library database program thing... There's an option for the user to view all books on loan.
I have two tables:
Books, which has columns ID*, ISBN, Author, Title, Year, Location
BorrowerStorage, which has columns Book ID, Name, Email Address, Desk Number
Book ID in BorrowerStorage is related to the Books primary key.
Now, for the viewing all books on loan, I want it to produce a read only table which contains all the entries from the BorrowerStorage table and the corresponding Title/Author columns (i.e. the records for which the ID in Books column = BookID in Borrower Storage column)...
I'm trying to create a temp table, which is populated by a string, (taken from a recordset).
My problem is incorporating the String into the SQL statment, and making it work,
What I'm trying to do is to create a temp table, and populate it with the first record of the recordset, (which is an e-mail address).
(The recordset and the strings work fine). It's the SQL statement which doesn't work.
Here's the code I have :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Set DBS = CurrentDb
Set RST = DBS.OpenRecordset("SELECT Contact FROM Contacts_to_be_Mailed")
Dim My_Count As Long
Dim ContactString As String
RST.MoveFirst
ContactString = RST(0)
Dim strTable As String
strTable = "TempContact"
DoCmd.RunSQL "INSERT * INTO " & strTable & " FROM ContactString "
I'm trying to insert 10% of a dataset from dbo_billing into another table Random_Temp. Another form is open when this query is to be ran that passess in the billyear and billmonth... I'm sure it's a syntax issue as I can isolate the random number part and it displays the appropriate data, I just can't re-write it to insert into the other table:
INSERT INTO Random_Temp ( indx, peopleId, audited )
SELECT TOP 10 PERCENT b.indx, b.peopleId, b.audited
FROM dbo_Billing AS b
WHERE (((b.billYear)=[Forms]![billing]![billyear]) AND ((b.billMonth)=[Forms]![billing]![billmonth]) AND ((b.recertifying)=-1))
ORDER BY Rnd(-(1000*b.indx)*Time());
Can anybody help me build the last table in my database? I have taught myself Access – and can usually get by with a little help from this forum. I have been trying for days to try and solve this !!!
The database is designed to manage feedback questionnaires from attendees of training courses.
I have attached the relationship diagram.
- A course may run for several days. The details of the course are held in the table ‘Courses’. During a course, attendees may be asked to fill in several Questionnaires
- An Attendee is a Person that attends a Course. Attendees are held in the table ‘Attendees’ and their details are held in the table ‘Person’.
- There is a ‘Library’ of questions that sit in the table ‘Questions’
- The questions can be assembled into “Standard Questionnaires”. These sit in the table called “Questdesign” which is a junction table. Assembling a Standard Questionnaire involves using a form to pick questions and give them an order (Qnumber). I HAVE DONE THIS.
- A specific “Questionnaire” is a “Standard Questionnaire” that is used on a specific course. The list of Questionnaires is held in the table “Questionnaire”
- Scoresheet is the junction table between Attendee and Questionnaire (an Attendee on a course may fill in several Questionnaires and a Questionnaire may be filled in by lots of Attendees.)
I now need a table (Scores) in which to put all the scores to the questions (in other words, the scores of the questions on the Questionnaires that are completed by the Attendees on a Course.)
At the end of the day I am aiming to have a form in which:
The Attendee number is entered and all the person’s details are filled in automatically) – I HAVE DONE THIS
The Questionnaire number is entered and all the course details are filled in automatically – I HAVE DONE THIS
A Scoresheet ID is filled in (Autonumber) - I HAVE DONE THIS
A subform appears which shows the right set of questions and question numbers for the appropriate Questionnaire – with a blank column so that the user can fill in the scores which get stored in the Scores Table. - I CAN'T DO THIS !!!
I cannot work out where to link my Scores table and how to build a query that drives the correct behaviour of the subform
I hope I have explained this clearly. I would be so grateful for any help. This Forum is fabulous.
Many thanks
NoVoiceLeft
Using Access 2000 is it possible to specify a starting location ie (c:) and using VBA search every sub folder from this point for files ending .mdb or .xls?
I want to be able to build a table with an record showing the file name and directory for each file found.
Any help most appreciated.
Regards,
Dalien51
Access 2000: How can I populate a two field table (1. Table Name 2. Field Name) with the name of ever field within every table in my database using VBA code?
Regards,
Dalien51
I have been building my DB and learning everything from scratch. If anybody could give me any advice as to where I may be going astray, it would be much appreciated as I feel like I've hit a brick wall. I run a building firm and need a DB to look after customer information, write estimates, invoices and ultimately do the accounts.
I think my DB needs are very basic to start with and I'm guessing the system only needs to be fairly simple and straightforward. So far my DB has:-
•Customer form with an in-built Estimate subform - this form gives me a brief outline of the customer and how many estimates I have for him.
•If you then double click on an estimate number (in the Estimate subform) this takes you to my Items form (when I create an estimate normally in Word, I have to break jobs down into their components and price each item individually, hence I made an Items table). Each item has an Item Cost.
•I then run the report “Estimate” and have set up a total calculation box on the report ready to print it out for the customer.
My problem is that I would like to know how I can get the Estimate Total to appear in my Estimates Table and Estimates Subform. So far I have achieved making a crosstab query to calculate the Estimate Total (Amount) for each specific Estimate ID, but I cannot get the Total from the Crosstab Query into the Estimate Table, from which I would probably be able to get it into the Estimate Subform. I have a suspicion I need to build an expression in the Estimate Subform - but.....
Once I am over this problem I will want to turn Estimates into Invoices and have that data displayed in my Estimate Subform too, although I think I have got a good idea of how to do this, I would again be open to comments/advice if offered.
Thanks Steve
Hello!I have a table, with quantities in a field that I need to split in batches of 25, to build a new table. Example:object price qtyblah1 1.00 144blah2 2.00 76My results need to look like this:object price qtyblah1 25.00 25blah1 25.00 25blah1 25.00 25blah1 25.00 25blah1 25.00 25blah1 19.00 19 (5x25+19=144)blah2 50.00 25blah2 50.00 25blah2 50.00 25blah2 2.00 1 (3x25+1=76)I've been able to build a new table based on these values of 25 etc using MOD, but it's making columns. How can I build a new table and make new RECORDS using MODULUS (or another?) technique instead?? I hope this makes sense, and I hope someone can help.Cheers
View 4 Replies View RelatedI am attempting to build a table relationship, however when I enforce referential integrity, I keep receiving the message: "No unique index found for the referenced field of the primary table".
I checked and I have no duplicates in the primary table or secondary table.I will set up the two tables as thus: 1. Master table - People Who Eat 2. Secondary table - a table for all people who eat pizza.
I am trying to link my pizza table to the Poeple Who Eat table. I have created my own primary key for each table (an account number). My secondary table is much smaller in population than the People Who Eat table (which would include data from other subgroups). I am trying to get the 'yes'/'no'/'uncertain' from the secondary table into the primary table without manual entry.
I have searched all over the web and have not been able to find why the tables will not link. I am new to Access, so there may be something I am overlooking. Is there a way to get this information from the other table other than building a relationship?
Im trying to sum a value within subform able before I even start I get ####Error as I have put in the control source the rule to create the sum
Code:
=Sum([TempTable].[hours])
I then have a function when another value is added it requires the text box which holds the sum value.
Can somebody point me in the direction of a good website to find out about how temporary tables are used?
We have one that picks up all fields in table except one and I have no idea how the information is gathered or where it comes from.
Thanks.
Hi There,
Is it poss to create a temp variable in a query. I want its value to be some text then a field:
"some text " + [name]
How do I create this in the query?
Thanks,
Hello eveyone.. I have a slight problem which goes way over my knowledge of the subject!
I have to make a form saying "ISLAND HORSE RACING CLUB" appear for 5 seconds before loading up the main form to add records but I cannot for the life of me figure out how to do it!!
anyone got any pointers? had a look at "timed events" on this forum but dont know how to implement it to help me
Any help would be appreciated
Regards
AaRrGgHh
Hopefully someone can point me in the right direction.
I have a small spare parts db which also has pictures of some of the parts.
manufacturer
partnumber
wholesale
retail
picture
The form carries data on wholesale price which I would need to hide if the customer would like to see a picture of the required spare part.
Is it possible to have a button to temporary make the wholesale field non-visible? Or would it be better to click on a button to open a new page with just the picture of the selected part and the retail price, if so what is the best way to achieve this.
Thank you in advance for any assistance.
Kim
I am using different values of a record (selected from a combobox) in my form/table which a user can edit and afterwards use for calculations and reports. the problem I encounter is that the fields are bound so if changed there is no undo if not mistaken.Is there a way to have for instance load a record in a temporary place (without making a large amount of temporary variables) and only update if the "save" button is pressed?
View 1 Replies View RelatedI'm thinking about creating temporary (while db open) relationships between tables, since transfering tables is possible only if no linked relationships are present. However it's important to preserve in some cases referential integrity.Looking online, I found this code:
Code:
Public Function CreateRelation(primaryTableName As String, _
primaryFieldName As String, foreignTableName As String, _
foreignFieldName As String) As Boolean
[code]...
Even with the comments I don't really understand what exactly this code does or doesn't do.I tried the code. It seems (?) to create a relationship. Since the relationship doesn't show up in the relationships table, I'm not really sure if it's there.
- why it's not visible among other relashionships (or is it me?? maybe, it wasn't the code that was working but the query...)
- how to implement referential integrity
- what's the behaviour of this supposed relationship. Is it permanent or not? If not when is it deleted?
I have my Data Types sent to "Date/Time" and a format YYYY/MM/DD.
What is a good method of handling approximate dates? IE: Early April 2012, or ~5/14/2012, or TBD.
Eventually, I want to create queries to calculate dates against each other.
My setup:
frmUsedOilContract (contains a header and a subform)
subfrmUsedOilContract (contains a few controls) [datasheet view]
- Removed Date
- Voucher Number
- Building Number
I implemented some code so that a temporary default value could be set for the date and the Voucher Number. I also have the default value for 'txtRemovalDate' set at 'Date()'.
PHP Code:
Private Sub txtVoucherNumber_AfterUpdate()  'Set current value to default value. Â
txtVoucherNumber.DefaultValue = txtVoucherNumber.ValueEnd SubÂ
PHP Code:
Private Sub txtRemovalDate_AfterUpdate()  'Set current value to default value. Â
txtRemovalDate.DefaultValue = txtRemovalDate.ValueEnd SubÂ
Also have code so the default value is null when the form is opened.
PHP Code:
Private Sub Form_Open(Cancel As Integer)  'Set Default Value properties to nothing. Â
txtVoucherNumber.DefaultValue = vbNullString  txtRemovalDate.DefaultValue = vbNullStringEnd SubÂ
This all works great until I try to change the date. If I use the default date (today's date), the new record will stay with today's date. If I change it to a different date, the new record displays a time instead.
I have been trying to create a login form that allows the user to change his/her temporary password logging it to the proper table along with timestamp and who done it info.But, after spending the morning trying to find the proper syntax I am flummoxed.
I can get everything to work accept the update of the fields. I can get the command to work (writes to the location) but it does the pop-up what is the parameter thing when it works. I have all the information just need to get it in so the command recognizes it.
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE lut_TeamList SET Pass = txt_Password.value WHERE TeamListID = Me.cbo_UserName.Value"
DoCmd.RunSQL "UPDATE lut_TeamList SET UpdatedBy = Me.cbo_UserName.Value WHERE TeamListID = Me.cbo_UserName.Value"
DoCmd.RunSQL "UPDATE lut_TeamList SET UpdatedWhen = Now() WHERE TeamListID = Me.cbo_UserName.Value
DoCmd.SetWarnings True