If A Make-table Query Result Is Null, How To Have A Default Message Appear In Table ?
Jan 21, 2005
Hi everybody,
Beginner here needs help !
I'm building a make-table query for which if the result is null (no record correspond to the set of criterias), a default message like "there was no activity during the period" would appear in the table (not a message box...I need the message in the output table). The best I could think of is an IIF function but it doesn't seem to work... Is there any way to do this without using VBA?
I'm new to programming with Access but am attempting to create a new field in a table with an new date based on existing fields in the table.
The current fields are [Frequency], integer, [Risk], text, [Last Audit Date], date/time, and the new field is [Next Audit Date]. [Frequency] is a calculated field based only on [Risk] and is equal to "5" if [Risk] is "Low" and is "3" is [Risk] is "Medium" or "High", and [Frequency] is blank if [Risk] is (thus far it has never been empty).
What I need the new calculated field to do is return "N/A" (or blank, or anything easily separated really) if [Frequency] is blank, or if [Risk] is "Low" or "Medium". If [Risk] is "High", [Next Audit Date] should be equal to [Last Audit Date] plus 3 years. When I try to save the code, I get this message: "The expression could not be saved because its result type, such as binary or NULL, is not supported by the server."
This is my code now: IIf(IsNull([Frequency]),"",IIf([Risk]="Low","N/A",IIf([Risk]="Medium","N/A",IIf([Last Audit Date]="N/A","N/A",[Last Audit Date]+Year(3)))))
Hi, I am extracting data from linked db2 table using access make table query. First I create a select query and can view the linked db2 data, but when I change to a make table query I get an error message, "invalid argument", when I run the make table query. There is no selection critera specified. Has anyone had this happen? and Do you know a solution?
I wanted to know if it is possible to change the name of the Table which is going to be created using a Make-Table Query via code (VBA).
For example if my Make-Table query currently creates a table with the name "Table1" I want to change it to name "Table2" and then change it Back to "Table1" or "Table3" etc.... depending on the users selection.
I've got a problem with a make-table query that creates a new table which is then populated with new values that relate back to the original table the trouble is the make-table won't run with that relationship in place.
Is there a way to delete the relationship then reinstate it after the query? or any other way round that someone can think of.
I have come across a snag in my access project I am currently undertaking and need some advise on what should be done next. . .
In a nutshell, this project's primary purpose is to perform a search on a table of information based on many fields and generate a report based on the records which match the search. I have the search form working (similar to this one here) http://allenbrowne.com/ser-62.html
It displays the results from the table based on the search criteria. The form is great for viewing the results which match search criteria; however, I am having trouble doing anything else with the data (perform operations on the data, send the results to the table, etc. . .). How should I go about moving this data to a table?:confused:
I have used/am using the "INTO tbl_temp_copy" to create a temp table from a query called tbl_temp_comp. Everytime I run my query it deletes and then creates a new table with the same name - and this is what I have been wanting.
However now I would like to create a table with the date in the table name so:- "INTO tbl_temp_copy_Date()" but obviously this does not work and I do not know if it is even possible?
Anyone able to do this or know that it cannot be done?
Days on Hold: calcworkdays([on hold date],[off hold date])-1
Now i have a module thingy set up (calcworkdays) which works out working days. What this expression does, when theres an on hold date and an off hold date is work out how many working days something is on hold.
Now, problem is, not always is something on hold, therefore fields are often blank and then i get a result in query that says "#Error", but i want to use the answer to this expression in another formula, but when error is displayed it makes the other query show error too.
What I want is some sort of If statement or similar so that if no results exist to display "0". Can anyone tell me how to add this in?
I'm a total Access Noob, it took me forever to work out this working days thing (damn access for not being as simple as excel!)
I think my problem might lie in the way the function has been written. I think i might have to modify this to show "0", rather than "error"
This is what ive got in the function.
Public Function calcWorkDays(dteStart As Date, dteEnd As Date) As Long Dim i As Long 'day counter Dim dteCurDay As Date 'set i = 1 if you want the first date to count as a full day 'or i = 0 if you do not want the first day to count as a full day
i = 0 dteCurDay = dteStart Do Until dteCurDay >= dteEnd 'check date against holiday table If 0 = DCount("[HolidayDate]", "tblHolidays", "[HolidayDate] = #" & dteCurDay & "#") Then 'continue checking for weekdays If Weekday(dteCurDay, vbSunday) <> vbSunday And _ Weekday(dteCurDay, vbSunday) <> vbSaturday Then i = i + 1 End If End If dteCurDay = DateAdd("d", 1, dteCurDay) Loop calcWorkDays = i End Function
New to this forum so be gentle! I'm also recently self taught on Access 2003 and developed a fairly substantial database for my company to track projects. My terminology may be off but hopefully youcan follow.
I have a number of queries created by copying existing queries and tweaking them. I was attempting to fine tune one of these by removing tables that had no bearing on the query. I was surprised to find that the number of records returned changed when I did this. I tried this with a number of queries and it seems to be common, on my database at least.
The tables removed had no fields selected for the query and had reltionships to only 1 of the remaining tables so it shouldn't have made any difference? In ever instance, the returned record set was a smaller nukber than before the unused table was removed.
I want to save an Access query result to a Table, but I couldn't find a way. The only thing I can do is save the result to excel or as a query in another file. Any hints? Thank you very much.
there is a query which i made which counts data from two tables RAUTH AND PERS
SELECT RAUTH.coy, RAUTH.Auth, Count(RAUTH.coy) AS Held FROM pers INNER JOIN RAUTH ON pers.coy = RAUTH.coy GROUP BY RAUTH.coy, RAUTH.Auth;
THERE IS A BLANK FIELD NAMED HELD in table RAUTH i want to update the held result which i quired into HELD fiedl of RAUTH table where COY (Field) is COY field of PERS table
RAUTH table structure
Coy Auth Held
Tata 12 Dell 11 HP 21 Opera 11 Bangour 10 pers table
Persno Name Coy Qual
124578 Gita Tata Bsc 235689 Sonu Dell BA 748596 Kiran HP BCA 459687 Sony Tata MCA 965214 Baiju Bangour CCNA 963656 Ashok Opera MCA
How to take the results of query and copy them to a column in a table?
I am using sharepoint and ms access together, and Sharpoint in this instance will not reference the result of the query. I can only use table fields with Sharepoint...major pain....
Example, I need riders name, weight and height from the column in ALL INfo query to automatically fill the column table in ALL Info
How to add my own rows to a query in MsAccess ? I would like to do something like this: Select Name from Table 1 where age > 75 Union Select "Joe" from Dual; Expected Result: If Joe is not found in Table 1 ,then it would be added to the result of the query.How can I do it in MsAccess as it does not use " DUAL" table.
I have a created a query which I want to update a table. The field is called DTP. I have the Workingdays2 module in place as well as the Holidays Table. The dates (date only) are called Time in and Transaction date. I want the table to update records only if the entry in Completed is Yes. I have attached screenshot of what I have in query. I am no good whatsoever at VBA so I used the Query design view. It shows how many records will be updated (which is a valid number) and shows me which field will be updated. However when I run the query and then opend the Table the DTP field is empty.
Whats the best way to show the text result of a combo box selection when displaying the information through a query? I notice the table is also reflecting only the numerical ID result of the selection so I'm not sure how to take this result and display it as a text result to the user.
:confused: I am using a Make Table Query to filter a Linked Excel Table. Is there a way to cut/drop the first 8 characters of the text out of one of the fields as it creates the new table?
Field NameExcel DataFinal Data Model_NameLATITUDE D600D600
Also, the final table has two Relationships with two other tables. When I run the Make Table Query once a week, I have to break the relationship to get it to run. Is there an easier way to dial with this?
Is there a way in a Make-Table query to tell the table to open when it's created? I would assume there is a function or SQL code that would do this, but I know very little SQL. Can anyone point me in the right direction? Thanks!