What's Wrong With This Create Statement? (Urgent)
Jan 10, 2006CREATE TABLE Jobs
(jobname LONGTEXT(1000) NOT NULL, [desc] LONGTEXT(1000) NOT NULL,
[req] LONGTEXT(1000) NOT NULL, [specialreq] LONGTEXT(1000) NOT NULL)
Thanks!
CREATE TABLE Jobs
(jobname LONGTEXT(1000) NOT NULL, [desc] LONGTEXT(1000) NOT NULL,
[req] LONGTEXT(1000) NOT NULL, [specialreq] LONGTEXT(1000) NOT NULL)
Thanks!
I have 4 fields
Temp - Yes/No
Entry fee - Combo box with Early, Late & Free
On my 3rd field i need to set it so that if Temp=No and Entry Fee=Early
then 25 will appear otherwise if Temp=No and Entry Fee=Late
then 30 appears
on my 4th field i need to set it so that if Temp=yes and Entry Fee=Early
then 40 will appear otherwise if Temp=yes and Entry Fee=Late
then 45 appears...
hope this makes sense...
CurrentDb.Execute "INSERT INTO tblArchivepayment
(EntryDate,MemberID,PCNumber,ApplicationType,Timei n,TimeOut,UsedTime,
Amount,PaymentType) SELECT (EntryDate,MemberID,PCNumber,ApplicationType, TimeIn ,
TimeOut, UsedTime,Amount,PaymentType) FROM tblPayment WHERE MemberID = '" & MemberID & "'"
i got syntx in comma error
In the following if...then statement, even though the Debug.Print prints a "Null"
the Else part of the statement is executed. Any help is appreciated
Debug.Print Forms!frmReport!txtCustom1
'if id combo box is null then
If Len(Forms!frmReport!txtCustom1) = Null Then
Debug.Print "Then"
'Filter Null strCompanyName records
rst.Filter = "strCompanyName <> """""
Else
Debug.Print "Else"
' filter on portfilio id
rst.Filter = "strJobID = """ & Forms!frmReport!txtCustom1 & """"
End If
Output:
Null
Else
I can't seem to get this to work. This issue was addressed in a previous thread, but it's not working for me. Help
Private Sub append_data_Click()
Dim strSQL As String
DoCmd.SetWarnings False
strSQL = "INSERT INTO sob_org_item_Mon11_Step1 ( ORG, Item, [Set of Books] )" & _
"SELECT [Mon10 Perpetual 01400 Qty_Amt].ORG, [Mon10 Perpetual 01400 Qty_Amt].Item, SOB_FX_Rates.[Set of Books]" & _
"FROM SOB_FX_Rates RIGHT JOIN [Mon10 Perpetual 01400 Qty_Amt] ON SOB_FX_Rates.Org=[Mon10 Perpetual 01400 Qty_Amt].ORG" & _
"GROUP BY [Mon10 Perpetual 01400 Qty_Amt].ORG, [Mon10 Perpetual 01400 Qty_Amt].Item, SOB_FX_Rates.[Set of Books];"
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
I've tried this IIF statement in both a report and a query with the same result. I have another one that is almost identical that is correct. Here is the IIF in my query:Section 3 Total T&E: IIf([Section 3 Subotal]>"6000","$6000.00",[Section 3 Subotal])Here are the results:Section 3 Subotal -- Section 3 Total T&E$4,727.20 -- 4727.2$12,064.13 -- 12064.13As you can see, the results are not correct since 12,064.13 is greater than 6000.Any idea what I'm doing wrong?Thanks for your help!Mare
View 6 Replies View RelatedSELECT Fields
FROM table1 RIGHT JOIN table2 ON table1.Pubid = table2.PubID
WHERE (table1.PubType=[Forms]![frmCirculationByTitle]![comMemberType] Or [Forms]![frmCirculationByTitle]![comMemberType] Is null)
AND (table2.lAuditPeriod=[Forms]![frmCirculationByTitle]![comStartPeriod] Or [Forms]![frmCirculationByTitle]![comStartPeriod] IS null)
And (table2.lAuditPeriod=[Forms]![frmCirculationByTitle]![comEndPeriod] Or [Forms]![frmCirculationByTitle]![comEndPeriod] is null)
AND (table2.Unfinancial=[Forms]![frmCirculationByTitle]![chkCurrent] Or [Forms]![frmCirculationByTitle]![chkCurrent] IS null);
even if i only have one parameter (a member type, which should bring back at least 20 for each type of member) it returns nothing. if i do the same sql statement in a query and hard codee the value in i get data. it seems to be ignoring whatever is on the form.
*shrug*
%simon
SELECT (Max(ReferenceDescription.ReferenceID))
FROM (ReferenceDescription)
WHERE (ReferenceDescription.ReferenceID >= (ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID) AND ReferenceDescription.ReferenceID <= (INT(ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID * 0.9999))
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 RelatedHi,
I am writing ddl statement for creating tables in access, i would need to provide a default date for a date column, how can i do this in a ddl statement ?
In the table design window in the gui, i can do it by providing the default as "=format(now())" but it seems not to work in the ddl statement.
also, is it possible to generate the ddl sql statement for an existing table in the database, i would need to know how can this be done too.
Thanks for the help
Joy
I guess I need to create an if else statement for one of my fields in a query. The query basically calculates a dollar amount from certain fields in one of my tables and sums them together at the end with an expression.
I also have a true/false field in the same table. and if it's true then the expression in my query must equal 0, if false then it sum up the fields. Do I need to create a module for this or is it possible to do this directly in query? And if so, how?
Thanks,
Hey all
I have an online Access database and dont want to have to take it offline (download, update, upload) to create a new table.
Therefore I want to use a CREATE statement that I can run via an ASP page to create any additional tables.
I don't want to have to create the statements by hand so im looking for a way to create a table on my local version of access and export the SQL statement that would be used to create this table.
Any idea?
Thanks
Hi, I'm fairly new to Access and I'm trying to figure out how to create a validation rule via SQL. I searched through the forums but didn't find anything. Hope someone can point me in the right direction. For simplicity say I have the following extremely simple CREATE STATEMENT.
CREATE TABLE GAMES (
Name TEXT PRIMARY KEY NOT NULL,
Amount CURRENCY NOT NULL,
);
How could I rewrite the above query to specify that the only valid amounts allowed are say between 1 and 10?
I'm familiar with the Constraint statement and the Check clause but I can't get these to work in Access.
I can create a select query with a combo box in it by changing the property of one of the fields - making the display control to combo box and adding the values. No problem there.
What I want to do is to be able to create a query dynamically from vba using a CreateQueryDef statement.
The problem is that you can only pass an SQL string to CreateQueryDef, and the combo box values are not part of the SQL code, but are saved with the query (presumably the same way column layout gets saved).
Is there a way to create a query with VBA and include non-SQL layout criteria so I can have combo boxes?
I'm using Access 2002.
I want to create a button that executes an SQL statement in a form. The reason I can't just save a query and run the query from the form, is because the SQL statement needs to use a combobox value from the form. I've learned that docmd.runsql will not work for a simple select query.
View 5 Replies View RelatedHi guys i tried to run this create table statement and each time i get syntax error.
I pasted the code in sql view windows of access 2000 and pressed the run code and i get
this error massage saying there is syntax error. Could any one help me write correct
create table statement that does not give me this error.I know u might tell me why u
do not create table in design view or .. but i want to do this since i want learn this
method as well.thanks
CREATE TABLE PLAYERS
(PLAYERNO SMALLINT NOT NULL CHECK (PLAYERNO >0),
NAME CHAR(25) NOT NULL ,
INITIALS CHAR(5) NOT NULL ,
BIRTH_DATE DATETIME,
SEX CHAR(1) NOT NULL ,
JOINED SMALLINT CHECK (JOINED >=1980),
STREET CHAR(15) NOT NULL ,
HOUSENO CHAR(4),
POSTCODE CHAR(6),
TOWN CHAR(10) NOT NULL ,
PHONENO CHAR(10),
LEAGUENO CHAR(4),
PRIMARY KEY (PLAYERNO)
)
What is the syntax of create table and insert statement for access 2000 db.
I want to paste the create table and insert statement to access 2000 "sql view window".
Therefore i want the correct syntax and format for these statements.
The reason that i want do this is that I created an application that generates create
table and insert statements for access db in text file and this way i want to test my application if it
generated the statement correctly.
Hi guys i tried to run this create table statement and each time i get syntax error.
I pasted the code in sql view windows of access 2000 and pressed the run code and i get
this error massage saying there is syntax error. Could any one help me write correct
create table statement that does not give me this error.I know u might tell me why u
do not create table in design view or .. but i want to do this since i want learn this
method as well.thanks
Code:CREATE TABLE PLAYERS(PLAYERNO SMALLINT NOT NULL CHECK (PLAYERNO >0),NAME CHAR(25) NOT NULL ,INITIALS CHAR(5) NOT NULL ,BIRTH_DATE DATETIME,SEX CHAR(1) NOT NULL ,JOINED SMALLINT CHECK (JOINED >=1980),STREET CHAR(15) NOT NULL ,HOUSENO CHAR(4),POSTCODE CHAR(6),TOWN CHAR(10) NOT NULL ,PHONENO CHAR(10),LEAGUENO CHAR(4),PRIMARY KEY (PLAYERNO))
Details:
I have a Profile form that tracks the expiration date for each client's various certifications. These dates are set up in the Short Date format in the table design of Access.
Problem:
When a user accidentally presses an alphabetic key while updating an expiration date, an Access error message is triggered. This is confusing to my users as these messages are written in Access lingo. I would rather that nothing occurs at all. I wrote a case statement to disable each letter of the alphabet and applied it to the On Key Down Event for each expiration date control on my Profile form to solve this problem, but this must be applied to 28 separate controls. I would rather call a function that disables alphabetic keys for each date control in my form when called.
Questions:
How do I transform my Disable Alphabetic Keys Case Statement into a function that I can call for each expiration date control? I know that when writing a function certain variables have to be declared and/or initialized.
Also, will I need to create a function to re-enable alphabetic keys or is this unnecessary because the disable alpha keys function will only be called for specific controls, not the entire form?
What I Have Tried:
I have tried copying and pasting my Disable Alphabetic Keys Case Statement into a module to attempt to create a function, but it needs work.
Below I have included 2 types of code:
(1) The original On Key Down code applied to each date control on my form
(2) The same code written as an attempt at a function
Original Profile Form Code to Disable Alphabetic Keys in the On Key Down event for each date control
Private Sub txtCert1ExpDate_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
'All message box text is for me to test the code, not for the user to see
Case vbKeyA
MsgBox ("you pressed the A key")
[Code] .....
I am writing a very complex 'if statement' query expression. I need to create an alias column based on data from two data fields.
Here's the logic:
True: If [PP] = "WG" or "WS" or "WL" and If [GR] > 10 Then "Skilled" or
[GR] Between 6-9 Then "Semi - Skilled" or [GR] <6 Then "Unskilled"
False: "GS"
I have the following Select Statement:
SELECTTenant.ID, Tenant.[First Name], Tenant.[Last Name], Tenant.Address, Tenant.City, Tenant.State, Tenant.Zip, Tenant.[Home Phone], Tenant.[Cell Phone], Tenant.[Work Phone], Tenant.[Rented Unit],
Tenant.[Security Deposit], Tenant.[Move In], Tenant.[Move Out], Tenant.TenantID, Tenant.UnitID, Tenant.PropertyID, Tenant.OwnerID, Owner.Company, Owner.ID AS Expr1, Property.[Property Address],
[code]....
Now, I know that something in the UPDATE statement does not match my select statement.What should my Update Statement be, in order to update all the columns in the joined tables?
I have a query with the following criteria in one of the fields:
>=DateAdd("m",-12,fom()) And <=DateAdd("m",1,fom())
fom is a function for first of the current month. I need this query to be specific to what month it is when its ran so i want to only have this criteria if the month is > = october. If it isnt October or greater, i want the criteria to reflect this.
>=DateAdd("m",-12,fom()) And <=fom()
Which also works by itself. But when i add it to an iif statement it always produces no results. Below is the iif statement.
Iif(month(date())>=10, >=DateAdd("m",-12,fom()) And <=DateAdd("m",1,fom()),>=DateAdd("m",-12,fom()) And <=fom())
I have also added the column name to each expression and it still doesnt produce any results.
I am creating a multi-search form for a student database, where after I enter my search criteria I hit a "Run Query" command button and then it opens a query form with all of my criteria.So far I can search using last name, first name, and middle name. When I try to search with a start date and end date I am have issues.The start date and end date is for the class date. In the query form under the field, class date, for criteria I wrote:
Between IIf([Forms]![Search Form]![Start Date]="",1/1/10,[Forms]![Search Form]![Start Date]) And IIf([Forms]![Search Form]![End Date]="",4/25/15,[Forms]![Search Form]![End Date])
I want it when I write a date in the start date and end date I want it to give me a list of all the students who took the course between those dates. Also, if I leave the dates blank I want it to search all dates. The dates 1/1/10 and 4/25/15 are just the dates I gave because that is far back as my database goes.
I have a database of employees, sales, products(Sky and Mobile Phone Contracts) and customers(Need to be common and shared between all products). ( A door-to-door marketing company)
Since each product requires different inputting tables, I have inserted all the required fields into the tblSales and then I want to run a query in order to select the needed fields and create a new Sale of a specific product.
However at the same time I want to create a new customer, assign the sale to an employee, select the commission ID that he is going to receive for the job... etc. Well as you can see the problem is that it is not letting me do it due to the fact that an entry is missing in the other table for that client or a client is not yet created for the sale. (Only one autonumber is assigned.)
What am I doing wrong?
Just in case you want to look at my mess... I have attached the DB :P
Hello,
I have the following "range" table. I have a "txtBoxA" (numeric) and "txtBoxPrice". I have to look in the table for the corresponding range of "txtBoxA" and retrieve the VALUE for that range and store it in "txtBoxPrice"
LOW HIGH VALUE
1 500 40
501 1,000 70
1,001 2,500 90
Example: "txtBoxA" = 200 then the corresponding VALUE would be 40 and I would have to store 40 in "txtBoxPrice"
How would I do this??
I'm doing this in ACCESS
Thank you
My school coursework database is on my memory stick, and i have just opened it, and all my forms, reports and marcos have gone. The file has gone from 12000kb to 10000kb, and a table MSysCompactError automatically created itself. How can i get it all back?????
The last time i accessed the memory stick was on the school PC.
http://img485.imageshack.us/img485/1139/errorzm6.jpg