Little Help To Finish A Create Table SQl Query

Dec 26, 2006

Hi,

I have the below in an SQL query that is called by a button (At present) that creates a table with an autonumber Primary Key (Can do a single Autonumber PK or a multiple field PK at the moment with the SQL code), and i want to create a table but the table name (An maybe some fields) to be from a field in the table. How can i do this, and is the below correctly written?? it works OK, but may be untidy.

CREATE TABLE Discharges ( MainID COUNTER CONSTRAINT MainID PRIMARY KEY, DischargeDate1 date,
Program1 varchar, Eligibility1 yesno, Cap1 currency, Phase1 varchar(111),
SRFA1 yesno, DischargeDate2 date, Program2 varchar,
Eligibility2 yesno, Cap2 currency, Phase2 varchar, SRFA2 yesno,
DischargeDate3 date, Program3 varchar, Eligibility3 yesno,
Cap3 currency, Phase3 varchar, SRFA3 yesno, DischargeDate4 date,
Program4 varchar, Eligibility4 yesno, Cap4 currency, Phase4 varchar, SRFA4 yesno, testlabel memo)

Have tried:

CREATE TABLE [Form1].[User] (

CREATE TABLE Form1.User (

and then made the record save (To store the field value on the form) before running the SQL code, but nothing happens (No errors)

Thanks

Dan

View Replies


ADVERTISEMENT

General :: Create A Field With Start And Finish Date On Certificate Formatted Correctly

Aug 22, 2013

I am creating a access db for use with a training company. All is working great.

What I want to do is create certificates within Access and then print by the Course load. Easy enough and I can do this.

The courses usually last two or three days, so i want to create a field which has the start and finish date on the certificate formatted correctly.

I currently use this

Code:
CourseDate: DatePart("d",[StartDate]) & " & " & DatePart("d",[EndDate]) & " " & Format([EndDate],"mmmm") & " " & DatePart("yyyy",[EndDate])

within a query which returns this

29 & 30 May 2013

what i want to print on the certificate is this

29th & 30th May 2013

I need to have the 'st' or 'nd' or 'rd' or 'th' in the date.

View 3 Replies View Related

********* Really Need Help .Please Take A Look. Last To Finish************

Nov 1, 2006

Hello everyone ..I really really really really need help with this ..It have to be work but I don know why it’s not working . This is the last thing and I finish my project so if you help me I’ll really appreciate that.
Images and my db Included in my zip

View 7 Replies View Related

Create Table Query

May 31, 2005

Hi

Is there a quick way to split up a table into many other tables? I want to split the table by Client Number, so all the Clients with 1234, for example, are in a table called Client1234

I know the very long winded way, creating a ‘Create New Table’ query, inputting the Client Code criteria each time.

Is there a better more efficient way?

Thanks

coley

View 8 Replies View Related

Create Table Query

Mar 9, 2007

Hi,
I wrote a script which creates a new table and append records into it. Here are my codes:

For Each rst In dbs.tabledefs
If rst.NAME = "Biweekly_Temp_Table" Then
dbs.tabledefs.Delete rst.NAME
dbs.tabledefs.Refresh
End If
Next rst
qryBtt = "SELECT DEDPARMS" & payp & ".EMP_ID, DEDPARMS" & payp & ".FORMAT_NM, " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='R',[overded_am],0)) AS [Employer Amt], Sum(IIf(Right([DEDETAIL" & payp & ".Dedtype_CD],1)='R',[DEDETAIL" & payp & ".ded_am],0)) AS [Employer Actl], " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='A',[overded_am],0)) AS [Admin Amt], Sum(IIf(Right([DEDETAIL" & payp & ".Dedtype_CD],1)='A',[DEDETAIL" & payp & ".ded_am],0)) AS [Admin Actl], " & _
"Sum(IIf(Right([DEDPARMS" & payp & ".Dedtype_CD],1)='E',[overded_am],0)) AS [Employee Amt], Sum(IIf(Right([DEDETAIL" & payp & ".Dedtype_CD],1)='E',[DEDETAIL" & payp & ".ded_am],0)) AS [Employee Actl], " & _
"First(DEDPARMS" & payp & ".STATUS) AS FirstOfSTATUS, First(DEDPARMS" & payp & ".AGENCY) AS FirstOfAGENCY, " & _
"First(DEDPARMS" & payp & ".TITLE) AS FirstOfTITLE, First(Right(DEDPARMS" & payp & ".title,2)) AS RepUnit, Left([DEDPARMS" & payp & ".DEDTYPE_CD],2) AS Type, " & _
"Left([DEDPARMS" & payp & ".DEDTYPE_CD],2) AS LeftType, Sum(DEDPARMS" & payp & ".NBR) AS SumOfNBR, First(DEDPARMS" & payp & ".DEDTYPE_CD) AS FirstOfDEDTYPE_CD1, " & _
"First(Right([DEDPARMS" & payp & ".DEDPlan_CD],2)) AS Tier, First(Left([DEDPARMS" & payp & ".DEDPlan_CD],2)) AS Carrier, DEDPARMS" & payp & ".DEDPLAN_CD Into Biweekly_Temp_Table " & _
"FROM DEDPARMS" & payp & " LEFT JOIN DEDETAIL" & payp & " ON (DEDPARMS" & payp & ".EMP_ID = DEDETAIL" & payp & ".EMP_ID) AND (DEDPARMS" & payp & ".DEDTYPE_CD = DEDETAIL" & payp & ".DEDTYPE_CD) " & _
"GROUP BY DEDPARMS" & payp & ".EMP_ID, DEDPARMS" & payp & ".FORMAT_NM, Left([DEDPARMS" & payp & ".DEDTYPE_CD],2), Left([DEDPARMS" & payp & ".DEDTYPE_CD],2), DEDPARMS" & payp & ".DEDPLAN_CD " & _
"HAVING (((First(DEDPARMS" & payp & ".STATUS)) Not In ('P'))) " & _
"ORDER BY DEDPARMS" & payp & ".EMP_ID, First(DEDPARMS" & payp & ".STATUS);"
DoCmd.RunSQL qryBtt


NOW THE ISSUE IS, AN ALERT MESSAGE ALWAYS POP UP SAYING SOMETHING LIKE, "You are about to paste 34590 row(s) into a new table." What would I have to do to get rid of this pop up? Eventually my users are going to use this and I don't want them to be alarmed when the message pop up.
Thank.

Joe

View 4 Replies View Related

Create Table Query

Feb 13, 2007

can I use create table query and change a fields data type?

I have a field with numbers, but when I get the table, it is set as a text field. I want it to be a number field, but I can't change the orignal table. That's why I was going to use a create table query, but I can't figure out how to change the data type from text to number.

Thanks

View 1 Replies View Related

Race Finish Place

Jan 17, 2006

Is there an easy way of doing this? I have a database that I want to automatically place racers as they finish. I have four race divisions. All racers no matter the division start at the same time. I have all of this figured out, but what is getting me is the finish place (1st, 2nd, etc.) Is there a way on a continuos form to automatically place the racers? How this works is...Main form has racer info., on this form is a stop button, and after the button is clicked, it will show his/her finishing place in their division which is subform of the main form. Here is the reason I want this. Someone may have registered wrong and they are in the wrong division, and we have to change them to the correct division after they have finished and already been placed. I want to be able to move them to the right division, and then my subform requery and they placed in the correct position in the new division. Sorry this is so lenghty. Plain and simple can I make a subreport have an unbound field that shows each records place the recordset? Thanks for your help, and like I said sorry this is so long.

View 4 Replies View Related

Help - Need To Finish Project Today!

Jun 14, 2006

Hi guys,

I need to finish the Asset Management System I have been creating today.

The main Asset Form works fine for Data Entry. However when I view existing records, the Model of the Asset (I.T Equipment) appears blank.

The reason for this is:
I have three tables linked in the following way:
Manufacturer > Model Group > Model

When an Asset is recorded in the DB, the user must select a Model.
To minimise duplicating data I decided to only store the Model ID in the Asset Table. This way, if I need to view the Manufacturer and Model Group, I can just do a reverse lookup based on the Model ID.

Problem:
The Manufacturer and Model Group are unbound combos. The Model is a bound combo filtered by the Model Group filtered by Manufacturer (aka Cascading Combos).

However, as I am not storing the values for Manufacturer and Model Group in my Asset Table, when viewing existing records, all combo boxes are blank.

Has anyone got a solution to this problem. I downloaded an example by Pat Hartman that requeries the filtered combo on the forms current event. However in that example the main combo was stored in the underlying table.

Any suggestions. Would really like to knock this one on the head today.

Can post an example DB if it would help

Many thanks
BF

View 6 Replies View Related

How Do I Create A Query Like A Pivot Table?

Nov 15, 2005

Hi Forumers...

I have data in a table that looks like this...

SITE-ID | VALUE
Site 1 | 20
Site 1 | 21
Site 1 | 16
Site 2 | 8
Site 2 | 9
Site 2 | 12
etc...

I would like to create a query that allows me to show summary statistics for each site. eg...

SITE-ID | VALUE_MIN | VALUE_MAX | VALUE_AVG
Site 1 | 16 | 21 | 19
Site 2 | 8 | 12 | 9.667
etc...

Am relatively new to MS Access and can't work out how to create a query that does this. Any help will be appreciated.

Using MS Access 2000 (9.0.7616 SP-3) on Windows 2000

Thanks,

Chris Medlin

View 3 Replies View Related

Create A New Row For Each Table Column In Query

Oct 26, 2006

I have a table which stores multiple materials in different columns, and the analysis results for each material in the associated cell. I need to create a query which will display a new row for each material and result with all the appropriate associations (location, date, time, etc.) Is there a way to do this in a single query? Do I have to create a separate query for each material?

Ultimately, I need to create an excel file which displays each material, the analysis result for that material, and the associated site, date/time values in a new row for each material.

Thanks for any help.

View 11 Replies View Related

Create VIEW From SQL Query On A TABLE Using VBA

Nov 8, 2006

How can we do this? Can someone pls help? The query should be part of the code. Like create a variable strSQL = "SELECT * FROM ...." and so on

Newbie here :)

View 2 Replies View Related

Create Table AS Select Query

Oct 25, 2007

Hello all,

Is there anyway to create a table from a query like you can in oracle?
i.e.

Create Table [B_match] AS
SELECT *
FROM [B_All]

Take care

View 2 Replies View Related

Run A Create-table Query Every 2nd Hour

Sep 18, 2006

Hi
I have made a create-tabel query that I want to run every 2. hour. How can I set Access up to do this automatically?

eroness

View 1 Replies View Related

General :: Need To Create Query From A Table

Apr 14, 2014

I have an old ERP system. The upload function is one line per value. So if I want to upload 7 models I need 7 lines, not one line with Qty of 7
however my source system sends the data as one line with Qty of 7

DLM2245/17DLM2245/17X1
DLP2204/17DLP2204/17X7
DLP2249/17DLP2249/17X7
DLV1004/17DLV1004/17X147
DLV1005/17DLV1005/17X158
DLV1009/17DLV1009/17X187

so in this example line 1 is fine. But line two needs 7 lines, and line 3 needs 7 lines and line 4 147 lines etc etc etc.so this is how the first three lines would look in the query.

DLM2245/17DLM2245/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X
DLP2204/17DLP2204/17X

[code]....

View 3 Replies View Related

Wait For Shell Execution To Finish?

Jun 19, 2007

I'm using hte Shell() function but this doesn't wait for the executable file to finish so I'm looking for a command line function that would wait until the executable file is finished executing...

I saw this function WaitFor but it is not supported in MS-Access? So, what do I do?

Thanks...

View 7 Replies View Related

Urgent Help Needed With Table Create Query.

Aug 6, 2007

Hi all, i need some help constructing a query that will create a table for me that does not include the Type value of 'promotion' if the same ID value exists elsewhere within the query.For instance, in the example below, i would want to delete the first entry containing 'Promotion' because ID2001 exists in two other places. However, if only one instance of ID2001 'Promotion' existed in my query, i would want to keep that entry. I would prefer to write all my data to a new table called "Test", This query has to sort out about 1000 entries when executed, otherwise i'd do it manually.I'm pulling my hair out with this one, so could someone help me?ID Company Name TypeID2001 Disc plc John PromotionID2001 Disc plc Paul AgentID2001 Disc plc George Agent

View 3 Replies View Related

Queries :: Create Summary Query For Each Table?

Dec 5, 2013

I have three tables with data.

Table1 is data for meals.
Table2 is data for room costs.
Table3 is data for payments made.

Each of these tables has a foreign key for EventID.I'm trying to produce a report that will show, for each EventID:

The total billed (which is meals + rooms)
The total paid (from Table3)
The balance due (the difference from the two above).

Do I have to create summary queries for each table?

View 2 Replies View Related

Queries :: Start And Finish Distance Within City - XLS

Mar 8, 2015

I use Access 2003 and want to make a query by specifying the start and finish within the city, I send files. a

Attached file ...

View 1 Replies View Related

Query That Will Select All Tables In The Database And Create One Table

Sep 16, 2007

I have a rotating number of tables that are created from excel spreadsheets that are imported. The Tables will change, but when they are there I need to be able to create a query that will merge them all together so I can run one query against all the tables. In SQL I know you can use a * to say Select *
From Table_1

Is there a syntax for the From portion so I can say:

Select *
From * (AKA all the tables in the Database)?

I have searched for a wildcard for the FROM statement that works like in the select statement but have been unsuccessful at finding an answer. Can anybody help? I'd list the Tables in the from Statement but there are 266 of them. Unless someone knows how to say:

Select *
From All tables in a folder with 266 excel spreadsheets

Thanks for your help
:)

View 1 Replies View Related

Adding Fields In A Table To Create New Field In A Query

Mar 14, 2008

I've got a fields called rev code that contain the following values:

field name: 110 131 250 255 258

field value: 7.49 6 11.25 12.11 78


I'm writing a query that pulls from the first two digits of the rev code and need to round off to the nearest dollar so in my query I'll have a column 11 with a value of 7, a column 13 with a value of 6, then I need to take columns 250 255 and 255 add the values together and round off so I get a column 25 with a value of 101.

How do I do that?

View 14 Replies View Related

Queries :: Create Table Query From Multiple Fields?

Aug 14, 2013

i essentially have 2 table:

1. Table BIC

A list of codes that will be updated monthly, which will be the basis for querying the second table. Approx 100 rows of data.

2. Table Original

A data file obtained from IT where i'll need to sort it to find any codes that are including in Table1. This includes approx ~ 10,000 row of data.

** note, the "BIC" from "Table BIC" can appear in any of the 5 BIC columns in Table Original.

What i need to do is create a query that will:

1. Search the "BIC" from "Table BIC" in all 5 columns of "Table Original".

2. Where it has a hit, it will create new table - for example, the first row of table Original includes the BIC "ABC" in the "BIC 1" column. A query would create table "ABC" and place this whole record (all 8 fields) in new table "ABC". No modification needed.

3. Where two (or more) BIC's from "Table BIC" appear in one record in "Table Original" - the result will only need to be placed in one of the new tables (really doesn't matter which one). For example, Record #4 includes the BIC "ABC" in field "BIC1" and the BIC "DEF" in the field "BIC4". Therefore, a new table would be created (either ABC or DEF) to capture this information.

View 4 Replies View Related

Queries :: Create Query To Sort Table In Particular Order

Feb 28, 2014

I have a table with multi columns with unsorted data.

I want to run query to sort data in multiple columns.

How can i do it?

View 1 Replies View Related

General :: Using Both Query And Table To Create Pivot Chart

Sep 7, 2014

I was just wondering if I could use a query and table to create pivot chart? and If so how I could do this? I need information from both in order to create the chart I want.

View 1 Replies View Related

Queries :: Display Start And Finish Time For Activity

Sep 18, 2013

I have a query that displays the start and finish time for an activity, I am trying to display the reults of the time between each activity....

For example
Name start End
aaa 14:07 14:09
aaa 14:11 14:12

The end time for the first activity was 14:09 and the next job was started at 14:11, so I want it to display 00:02: - (elapsed time)

Its very easy to do in excel as it would be =SUM(B2-C1) but haven't a clue how to do it in access.... is there any way?

View 3 Replies View Related

Forms :: Calculate Difference Between Start And Finish Time

Jan 30, 2014

I have a subform in which I want to calculate the difference between a start time and finish time, the problem I am having is when the start time is on a different date to the finish time

Start 23:15 on 14th Jan finish 00:015 on 15th Jan, also I want the answer to be the number of minutes. The fields I have are

BatchStartTime Short Time
BatchFinishTime Short Time
BoilTime ([BatchStartTime] - [BatchFinishTime]) General Number.

There are many batches to enter per job and the MainForm has the StartDate as I didn't want to enter the StartDate for each batch.

View 4 Replies View Related

Queries :: Create Numeric Query Fields In MAKE Table

May 25, 2014

Have a Make table query that needs to create (add) several new fields where each field must be numeric design.

Have tried:

Score1: Not Null - does not seem to work (results in a Binary field)
Score1: 0 - which does give me the numeric field designation but every field in table contains a 0.

Would like to show Blank field (makes data input easier at a later time) but still have the Numeric designation.

View 6 Replies View Related







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