Help Needed With An Sql Statement
Jul 14, 2005
Good evening
I am trying to write an sql statement but its not producing the results I want.
This is the statement I am trying to use.
SELECT [Table Jan 1999].[Bkg No], [Table Jan 1999].[Reporting To], [Table Jan 1999].[Start Date], [Table Jan 1999].[End Date], [Table Jan 1999].[Reason for Booking], [Table Jan 1999].[Temp Name], [Table Jan 1999].[Cost Code], [Table Jan 1999].[Assignment Job Title], [Table Jan 1999].Department, [Table Jan 1999].Status
FROM [Table Jan 1999]
WHERE ((([Table Jan 1999].[End Date]) Is Null)
AND (([Table Jan 1999].[Cost Code])="DE600149"
Or ([Table Jan 1999].[Cost Code])="DG6022820" Or ([Table Jan 1999].[Cost Code])="600414") OR ((([Table Jan 1999].[Cost Code])="DG6022820"))
OR ((([Table Jan 1999].[Cost Code])="600415")) OR ((([Table Jan 1999].[Cost Code])="DG6022821")) OR ((([Table Jan 1999].[Cost Code])="DG6022832"))
OR ((([Table Jan 1999].[Cost Code])="600421")) OR ((([Table Jan 1999].[Cost Code])="600432")) OR ((([Table Jan 1999].[Cost Code])="600433"))
OR ((([Table Jan 1999].[Cost Code])="600435")) OR ((([Table Jan 1999].[Cost Code])="600576")) OR ((([Table Jan 1999].[Cost Code])="600713"))
OR ((([Table Jan 1999].[Cost Code])="600724")) OR ((([Table Jan 1999].[Cost Code])="600965")) OR ((([Table Jan 1999].[Cost Code])="602716"))
OR ((([Table Jan 1999].[Cost Code])="602741")) OR ((([Table Jan 1999].[Cost Code])="602744")) OR ((([Table Jan 1999].[Cost Code])="602788"))
OR ((([Table Jan 1999].[Cost Code])="602789")) OR ((([Table Jan 1999].[Cost Code])="602810")) OR ((([Table Jan 1999].[Cost Code])="602811"))
OR ((([Table Jan 1999].[Cost Code])="602821")) OR ((([Table Jan 1999].[Cost Code])="602835")) OR ((([Table Jan 1999].[Cost Code])="602949"))
OR ((([Table Jan 1999].[Cost Code])="602969")) OR ((([Table Jan 1999].[Cost Code])="602980")) OR ((([Table Jan 1999].[Cost Code])="602988"))
OR ((([Table Jan 1999].[Cost Code])="602991")) OR ((([Table Jan 1999].[Cost Code])="603005")) OR ((([Table Jan 1999].[Cost Code])="500DW"))
OR ((([Table Jan 1999].[Cost Code])="500KP")) OR ((([Table Jan 1999].[Cost Code])="500LG")) OR ((([Table Jan 1999].[Cost Code])="501TE"))
OR ((([Table Jan 1999].[Cost Code])="502M3")) OR ((([Table Jan 1999].[Cost Code])="502Q0")) OR ((([Table Jan 1999].[Cost Code])="504KU"))
OR ((([Table Jan 1999].[Cost Code])="505BG")) OR ((([Table Jan 1999].[Cost Code])="506J1")) OR ((([Table Jan 1999].[Cost Code])="506J2"))
OR ((([Table Jan 1999].[Cost Code])="506J4")) OR ((([Table Jan 1999].[Cost Code])="506J5")) OR ((([Table Jan 1999].[Cost Code])="507FQ"))
OR ((([Table Jan 1999].[Cost Code])="507GC")) OR ((([Table Jan 1999].[Cost Code])="507Q4")) OR ((([Table Jan 1999].[Cost Code])="508SR"))
OR ((([Table Jan 1999].[Cost Code])="509Q5")) OR ((([Table Jan 1999].[Cost Code])="509RM")) OR ((([Table Jan 1999].[Cost Code])="DG2820")));
My problem is with this part
WHERE ((([Table Jan 1999].[End Date]) Is Null)
I thought by having Is Null would give me only results that have no value, But....when I run the query I am getting results with values.
Can anyone tell me what I am doing wrong?
TIA
View Replies
ADVERTISEMENT
Jan 12, 2005
ok, not sure if this belongs here on the the code help bit so I've posted it in both.
my code reads as follows:
Private Sub cmdNextStep_Click()
If PageIndex = 0 Then
pgeStepTwo.Visable = True
pgeStepTwo.SetFocus
pgeStepOne.Visable = False
Else
pgeStepThree.Visable = True
pgeStepThree.SetFocus
pgeStepTwo.Visable = False
End If
End Sub
Now the button works perfectly to go from Step One to Step Two but it will not go from Step Two to Step Three.
I've also tried "else if page index = 1" but still nothing happens when I click the button.
Any help will be much appreciated.
Katrina
View 1 Replies
View Related
Oct 16, 2004
Hi I had been trying to use the "Select" statment of the sql in Access.But how do I actually execute the sql command?
For example,
Dim sql As String
sql = "select * from Name"
What is the next line i should add to execute this in Access?
Thanks
View 5 Replies
View Related
Mar 11, 2006
SELECT (Max(ReferenceDescription.ReferenceID))
FROM (ReferenceDescription)
WHERE (ReferenceDescription.ReferenceID >= (ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID) AND ReferenceDescription.ReferenceID <= (INT(ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID * 0.9999))
View 1 Replies
View Related
Feb 12, 2014
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?
View 2 Replies
View Related
Oct 31, 2014
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.
View 4 Replies
View Related
Apr 28, 2015
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.
View 11 Replies
View Related
Apr 29, 2005
I need some help on a database that is set up for work use.
It's rather large and I have no technicial knowledge of access whatsoever so an answer in plain english would be appreciated.
I have attached a picture of the screen that i am having the problem with. The blank fields contain peoples names and addresses. On this page i have to click on "update service user" on the first user, the database opens a seperate page and i enter a few details, then i click to go back to this screen.
When I return back to the screen, the scroll bar is at the top of the list. This is OK when I am doing the first few letters of the alphabet (the users are listed alphabetically) but when i have too use the scroll bar and choose the letters later down the list, then click to update then return to the screen and the scroll barr is not where i left it...ie: it's at the top.
So what I am asking is, is there a way of freezing this scroll bar so it will stay there even when i have navigated away from the screen to update each user?
If someone could answer me this query then I would be most grateful as it's quite time consuming for me to use the scroll bar and find the next person that i need to update.
View 2 Replies
View Related
Mar 15, 2006
Hi, looking for help big time!! I am a novice at using MS Access and struggling like hell. I have been set a project at University that requires me to import data from Excel, sort the data (i.e the data imported will be for a whole year and I am only interested in looking at single months), use calculations on the data imported and display this graphically. Is this possible with Access?? Any help will be gladly received as Im desperate.:(
View 1 Replies
View Related
Sep 18, 2006
I have a multiple user access database on share drive with user-security level created. I created myself as administrator, and remove default Admin from Admin group. Removed permission from user group and joined workgroup file which I created as "MBS work group.mdw". I created shortcut on user's computer. I believe the syntax is correct
"C:Program FilesOffice 2003OFFICE11MSACCESS.EXE" /wrkgrp "\ServerNameMBS DatabaseMBS Work Group.mdw" "\ServerNameMBS DatabaseMBS.mdb"
Everything works fine. When I directly double click the database (MBS.mdb), it pops up a login box. However, when other user double clicks the database directly (not from shortcut) from their station, login window doesn't pop up. It allows them to access the database. I saw the work group file used default System.mdw
My question is how can I restrict them by double clicking the database without go through shortcut? Why my database security not protect user access without give user name and password. I tried by joined user’s work group file to MBS work group.mdw. It works, but I don’t want let user manually to do that one by one.
Is there anybody can help me go through this problem?
View 10 Replies
View Related
Dec 27, 2006
Sorry, i dont know where should i post this( under which category)
so i just post it here,
I want to create a login page using access,
and then i wanted to record down the name of the user and the time and date(login and log out) when he/she is using the database.
And then record it down in a table.
Any ideas fellow forumers :)
View 3 Replies
View Related
Jan 11, 2007
Hi,
I am fairly new to DB's and have been trying to get my head round a database I want to build. I have had a few pointers from other people on here which has helped etc.
I was wondering if anyone out there would mind helping me with this project. I will go into detail if anyone is interested. I am hoping that someone would let me add them to messenger so when I get stuck etc, I could drop them a quick note. I am not going to harrass you every minute of the day (I promise not to try to anyway :D ). I would like to work with someone so I dont have to keep explaining it to someone different each time.
If this is something that someone wouldnt mind doing, please, please, please let me know.
Many thanks
Jamie
View 2 Replies
View Related
Apr 21, 2007
So far I haven’t got help on my DB.
I am attaching my DB.
The DB has two tables: DiaryTable & RBCaseTable
I want to resolve two issues on this DB
First issue: The DyNo field will start from No.1 on new year (DMax function). Since there will be duplicate records with the same DyNo for every year, I want to filter the records year-wise. For the current year, I should be able to do data entry, edit, search, print etc. For the previous year’s records, no data entry should be allowed and only search and print to be allowed.
Second issue: Two fields in both the tables are same i.e. DyNo and Remarks. I want this to be linked. What I want to do is that after I open ‘frmRBCaseAdd’ when I type the DyNo, the form should show the ‘Remarks’ field of DiaryTable so that I could update/edit.
I know nothing about VBA coding etc. Whatever codes I put in this DB was obtained from this forum and I simply made changes to suit my requirements. However, I failed to get help on these two issues. I shall be grateful if you could kindly help me. Thanks in advance.
View 4 Replies
View Related
May 9, 2007
I need help please.
1. I have a [CmdBtn] to do some calculation on the first day of every month.(The Btn and calculation code are ready and working).
2. On clicking, the [CmdBtn] will look for [FieldTotal] entry. If no entry, it will execute.(This code is also fine and working).
3. While executing the command, it will populate the [FieldTotal] automatically so that second clicking of [CmdBtn] will take no action and the populated field will tell the user that calculation is already done.(Code for auto-populating is also fine and working)
4. On the last day of the month, the [FieldTotal] entry will be deleted.(Here also the code works fine.).
I have two tables Table1 & Table2. I have the form for Table1. The [FieldTotal] is in Table2. I inserted a TextBox in form and tried to link it to Table2.FieldTotal throu Data-ControlSource, but it is not working. When I open the form ‘#Name?’ appears in the [FieldTotal]. I tried changing the field property to Text and then Number. In both options, I get the same ‘#Name?’.
Interestingly, when I leave the text box as it is without linking it to Table2, the [FieldTotal] in my form appears blank. Here I am able to populate the [FieldTotal]. But when I exit and reopen the form, the text box is again blank.
Please guide me (1) in linking the Table2.[FieldTotal] to my text box in form (which is based on Table1) or (2) how to keep the text box entry permanent till the end of the month.
View 1 Replies
View Related
Oct 10, 2007
Hello, i need simple database for my artworks. i made a few tables, but now i have to connect them and add some features. Also i will need a few reports... i think i will not be able to do it mysef. so i am looking for help... does anybody interested in this project? i will pay with Paypal. please, let me know
thank you,
Elena.
View 4 Replies
View Related
Nov 4, 2007
i'm eric. joining a couple boards and looking
forward to participating. hehe unless i get
too distracted!
eric
View 6 Replies
View Related
Nov 8, 2007
I am a novice and need help, i have built a simple database and i need to find out how to automatically update files across a network as soon as possible it updates on a couple of machines strait away but on others i have to close the database and then reopen it to get the updates. In addition to this i want to be able to search for a reference at the click of a button.
Any help on this would be greatly appricated as i am a novice
Thanks
View 10 Replies
View Related
Feb 8, 2008
Ok i have a database works fine just run into a little porblem..
In My VBA Coding i have made a SQL quiery the code is..
Private Sub Form_AfterInsert()
DBEngine(0)(0).Execute "INSERT INTO availability (ID) " & _
" VALUES (" & Me.ID & ")", dbFailOnError
'---------------------- Below Is The Code That -----------------------
'-------------------------- Doesn't Work -----------------------------
DBEngine(0)(0).Execute "INSERT INTO availability (Name) " & _
" VALUES (" & Me.Name & ")", dbFailOnError
'----------------------------------------------------------------------
End Sub
ok so the insert of ID works but the insert of Name does not..
Am i doing something wrong?? can somebody help please i need it urgent..
P.S.
i have been using MySQL for about a Year working on PHP and it seems much different from this SQL here on access.. and my suggestion would look something like this
"INSERT INTO availability ('ID','Name'), VALUES ('Me.ID','Me.Name')
Something along Those Lines..
- Alan
View 1 Replies
View Related
Nov 16, 2004
:confused: Hi, am new here & i need some help with some access database. Its for a little project am using to learn access.
Ok am designing a website for an airline company using access as d database end & asp for coding & stuff. My problem is a table i called flight. I have to write out a flight schedule in d database but am not sure how to do it, i wrote a schedule down in words using days. let me explain that, what i did was i have about 10 countries my airline company flies to, so what i did was grp 5 countries to fly mondays,weds,fridays & sundays & d other 5 fly tuesdays,thursdays & saturday. I don't know how to put that in the table since in d frontend customers are supposed to be able to search by date. On the frontend is a drop down menu where they pick a date like 29th november 2004 & then it shows d flight details but my problem is i wrote it in days. what should i do?? :confused:
View 5 Replies
View Related
Apr 29, 2005
I need some help on a database that is set up for work use.
It's rather large and I have no technicial knowledge of access whatsoever so an answer in plain english would be appreciated.
I have attached a picture of the screen that i am having the problem with. The blank fields contain peoples names and addresses. On this page i have to click on "update service user" on the first user, the database opens a seperate page and i enter a few details, then i click to go back to this screen.
When I return back to the screen, the scroll bar is at the top of the list. This is OK when I am doing the first few letters of the alphabet (the users are listed alphabetically) but when i have too use the scroll bar and choose the letters later down the list, then click to update then return to the screen and the scroll barr is not where i left it...ie: it's at the top.
So what I am asking is, is there a way of freezing this scroll bar so it will stay there even when i have navigated away from the screen to update each user?
If someone could answer me this query then I would be most grateful as it's quite time consuming for me to use the scroll bar and find the next person that i need to update.
View 7 Replies
View Related
Nov 22, 2006
Hi all
I am really new to creating Databases and need some help with a problem i have. Basically all i want to do is have a table with say Customer Id, and Customer Address.
Then in another table or form (not sure which is best) when i put in the customer Id ,it will automatically fetch through the customer address, so i dont have to keep typing in the address all the time.
Is this easy to do? if so how can i do this?
Again thanks all
Chris
View 5 Replies
View Related
Dec 19, 2006
Hi i have a DB on my pc and Laptop, as soon as i copy it to a other pc I get the Message "Cannot update '(expression)' field not uddateable", when I try to run a update Query. :mad:
View 1 Replies
View Related
Mar 2, 2007
I have following tables:
1>StudentPersonalInfo:
StudentFirstName
StudentLastName
StudentType->Primary Key
StudentUserName-> Primary Key
2>StudentPlacementInfo
StudentUserName-> Primary Key
StudType->Primary key
AgcyUserName->Primary Key
FldInstUserName
SemID->primary key
3>AgencyInfo
AgencyUserName->primary key
AgcyID
AgcyName
I want to write a query that will give the name StudentFirstName,StudentLastName of all the students from the StudentPersonalInfo who are placed in an Agency(i.e AgcyUserName field is null in StudentPlacementInfo for that student).
Please help me in writing this query. I will really appreciate that
View 1 Replies
View Related
Mar 27, 2007
Problem:
"Display the Client Number, Name, and Balance fields for all the clients where the bookkeeper number is 22 or 24 and the balance is greater than $300.00."
how can I do all the operations @ the same time in one query???
I'me new to Access to I really need to know.
Thanks
View 1 Replies
View Related
Mar 12, 2006
I have searched the archives for hours but no luck.
I came across a sample db a while back that had a text field and two buttons on a form.
One button let you browse for the file name and it stored the result in the text box. The other button opened the result stored in the text box.
Has anyone a copy of this sample db or something similar.
Thanks in advance
h
View 3 Replies
View Related
Jun 14, 2005
I have a form that contains a field in which the user enters a number. How can I make the a report print copies of that entry the the number of times which equals the number entered in the field.
Example,
Total number of Folders: 4
I need to print 4 labels for that same record and for any other entry which contains a number.
Any help is greatly appreciated
View 2 Replies
View Related