If TableA Exists Then . . .
Sep 13, 2005
Hi again
How can I do an existence test on a table in my Access MDB in a script. The job is to determine if a temp table exists, and if so, then to drop the table.
What syntax would I use to accomplish this in form event code?
Thanks
EzRider
View Replies
ADVERTISEMENT
Oct 18, 2014
MAX ID/date. I need to get TableB to TableA without using Group by.
Code:
TableA:
ID name1 name2 dt
1 n1A n2A 1/1/2010
2 n1A n2B 1/1/2010
3 n1C n2C 3/12/2011
4 n1D n2D 5/03/2013
5 n1D n2E 6/7/2014
6 n1D n2F 8/12/2011
.
.
Code:
TableB:
ID name1 name2 dt
2 n1A n2B 1/1/2010
3 n1C n2C 3/12/2011
5 n1D n2E 6/7/2014
etc
View 3 Replies
View Related
Dec 1, 2012
We have Cardiac Rehab patients that come 3 times a week (M-W-F). Once they are on program they stay there for 3 months. There are classes given hourly from 8am thru 6pm. There are 12 available slots per class. Right now this is being handled in Excel, but I thought I might improve things by putting it in Access.
The Excel "form" I built has fields for PatientName, MedicalNotes, DoctorName, and Notes. Because the names rarely move (a patient gets a slot and stays there) the user opens Excel, reviews the form to make sure no one cancelled-is out sick-etc, then prints the schedule. When the day is complete I have a macro that takes this information and saves it in a tablelike manner on another sheet. A dynamic pivot table references this info to give the user quick answers as to daily volume, etc.
The thing I can't get my head around is how to make this as easy in Access. My thought was I could have a PatientT, listing all of the fields mentioned above. I could have DailyF open, bound to PatientT, with additional unbound textboxes to add "today's date", cancellations or no shows, and then Save all of this in another table and print out the daily schedule.
View 7 Replies
View Related
Dec 23, 2004
Hi guys...got a problem here....
I got a query which joins two table....
Individual
fid1
fQSname
fQSRegno
Point
fid2
fQSRegno
fQSPoint
Tables join using fQSRegno.
Scenario is
Tbl Individual contains all the members info.Tbl Point contains point given to members who attend courses. Problem is when I created a query...
Query1
fid3
fQSname
fQSRegno *from tblPoint
fQSPoint
the data shows only members who got points. Is it possible to include member who don't have point like new registred member to show in this query....
TQ
View 1 Replies
View Related
Jul 14, 2005
I have 2 identic tables: T1 and T2 which contain only one field NR.
T1 contains the data:
1
2
3
4
5
6
7
8
9
10
11
12
T2 contains the data:
5
6
7
8
A
B
C
D
I want to select all the records found in T1, but not found in T2. So, I wrote the following SQL query:
SELECT T1.NR
FROM T1
WHERE NOT EXISTS
(select T2.NR
from T2);
Unfortunately, this query doesn`t return any record. And the strangest thing is that the query:
SELECT T1.NR
FROM T1
WHERE NOT EXISTS
(select T2.NR
from T2);
have the same effect like:
SELECT * FROM T1,
I mean it returns all the records of T1. I mention that the query was written in Access. What I have to do? Can anybody help me? What solutions do I have? I need a query, not a VBA code!
Thank you in advance!
View 10 Replies
View Related
Oct 13, 2005
I need to make a query that only selects data that is in another query/table.
I have tried to do this using a query with IN criteria as follows.
SELECT fldOne,fldTwo,fldThree,
FROM tblOne
WHERE (((tblOne.fldOne) In (Select fldOne from tblTwo)) AND ((tblOne.fldTwo) In (Select fldTwo from tblTwo));
But that isn't working. Any ideas as to why?
I think that the answer might be using the EXISTS reserved word, but I don't know how.
View 1 Replies
View Related
Mar 23, 2006
I have a table (tblSales) with these fields (RecDate, Code, Type, OrderCount).
I also have a linked table (lnkSales) with these fields.
Daily I append the data from the lnkSales to tblSales.
The tblSales table must have a record for each code daily.
These are the codes (01,02,05,07,09,10,15).
I need to automatically add a record for each code that wasn't appended.
For example,
lnkSales contains:
03/22/06 01 Mc 3
03/22/06 02 Mc 1
03/22/06 05 Mc 1
03/22/06 07 Mc 2
03/22/06 10 Mc 1
When appended to tblSales there is no record for code 09 or 15.
I need to add these records to tblSales
03/22/06 09 Mc 0
03/22/06 15 Mc 0
Can someone explain the best way to accomplish this?
Thanks.
View 3 Replies
View Related
Jul 19, 2006
Hi, I have the following problem which I hope someone can help me with:
I have a form which is used to enter data into a table. One of the fields is 'Code'. I want the form to check when data is enetered into this field is it already exists, ie if the code is already present in the 'code' field in the table, and if it is it should give a warning message, if not then continue as normal.
Any help would be greatly appreciated, thanks in advance!
View 2 Replies
View Related
Mar 21, 2013
I have a form used to enter new contacts. I would like to insert a query or macro that would automatically to see if the name (first and last) already exists in the table to which this form is attached. If the name exists, I want to open the existing record and add information to it. If not, I want to enter the information as a new record.
View 1 Replies
View Related
May 18, 2006
I keep getting the error message "Table TempMsysAccessObjects already exists" when I try to compact/repair my database. The only help I've found in the MS knowledge base just says to delete the table. I keep deleting it, but it keeps coming back. I've tried the decompile cmd line option, no change. Do I need to just rebuild this db, or what?
Access 2002.
Thanks for any ideas.
View 1 Replies
View Related
Dec 12, 2005
I'm running the following line:
dbs.Execute ("DROP TABLE [tbl_No Certs]")
the problem is that sometimes the table doesn't exist... Instead of trapping the error code, is there a way I can check to see if the table exists? If it doesn't I'll simply skip this step of my code and move on.
Thanks!
View 2 Replies
View Related
Dec 13, 2005
I have tried the attached code from a previous post http://www.access-programmers.co.uk/forums/showthread.php?t=98727&highlight=table+exists but some of the code doesn't work on Microsoft Access Project.
Does anyone have any ideas how I would amend this code so that it works?
Regards
Carly
View 2 Replies
View Related
Jul 18, 2006
I have created a query/report that meets all necessary criteria except that it contains multiple TYPEs per employee. This isn’t an issue unless one of the TYPEs is ‘W’.
As TYPE ‘W’ supersedes all other TYPEs, any others that meet the other criteria should no longer be reflected in the query/report.
Is it possible to add criteria for this?
View 4 Replies
View Related
Jul 31, 2006
Hi,
I have a java app connected to a MS access database. I need to run an sql command like
"drop table if exists"
You know, so it only tries to delete the table if its actually there. Im not sure how to do this with an access db.
Also what is the difference between delete and drop.
thanks v much for any help!
View 1 Replies
View Related
Aug 9, 2006
I know this can be done i MySQL and with SQL Server but is there a way to drop the table but check if it exists first in Access before running a query ?
View 1 Replies
View Related
Aug 24, 2006
Hi Guys,
Is it possible to find out if there is an Index on a table or not? I am using VB6 and Microsoft Access database? please don't ask y!!!
TIA
STA
View 4 Replies
View Related
Feb 12, 2007
I have 2 tables
TKYOKUMD01 and TTOKUKMD01.
So Im supposed to get the records that aint found by this query in the TKYOKUMD01 table:
SELECT a.* FROM TKYOKUMD01 a, TTOKUKMD01 b WHERE a.KYOKUSYOCD & a.BUNSITUCD = b.KYOKUSYOCD & b.BUNSITUCD
Easy right? All I have to do is use NOT EXISTS Right? So I did, hence:
SELECT * FROM TKYOKUMD01
WHERE NOT EXISTS (SELECT a.* FROM TKYOKUMD01 a, TTOKUKMD01 b WHERE a.KYOKUSYOCD & a.BUNSITUCD = b.KYOKUSYOCD & b.BUNSITUCD)
No records returned, so maybe all is good and happy in their relationship interconnected world. So just to check I inputted 99999 for KYOKUSYOCD and 9 FOR BUNSITUCD in the TKYOKUMD01, now clearly it should appear right? Coz its there, on the blessed SQL code. BUt the I ran it, BAM, no results? Whaja...juhh...
Please please please help me with this, is there something wrong with this statement coz Im pretty sure I was right :(
Oh and I have 24,000 records in the TKYOKUMD01 table and 18,000 records on the TTOKUKMD01 table, weird eh? Every one in the 24K table is in the 18K table? Like, what I said, Whaja...juhhh....
Please help :D
View 7 Replies
View Related
Mar 12, 2007
(hard being a rookie)
On my Form, I want to have a query look at one specific field for a number (1). If the number is found then I would like to have the query do basic subtraction on two other fields. (one from each table)
What I have so far is one unbound text box with the following,
=IIf(tblDaStrategy!DaNumber=1,(tblDaStrategy!DaTar get-tblDaReport!DaActual1))
Simply put, if one field has the number one in it, then take the other two fields and subtract (ex. 100-75) to display 25.
It's not working. I keep getting the #Name?
Update: I think I got it. I went back to square one and made a master query that contains the data from both tables. Then I bound one of the forms to the query. I updated my IIF statement and poof. It seems to be working. Now, where's the Asprin and my pillow?
Update 2: Bummer, now my magical 25 is in place but now my form is locked tight. Guess I need to consider abandoning this concept and simply producing a report with the 25 on it. Unless someone out there has a better idea.
View 1 Replies
View Related
Jun 5, 2007
Hi, i have a simple query but for some reason it's not working.
Let me get to the point.
2 tables - table1(id,txtfield1) table2(userid, idfield)
idfield contains id so foreign key (although hasnt been set up as that yet)
Aim: select all fields from table1 where table2 doesn't contain them.
e.g if table 1 had, 5 rows containing:
1 - test
2 - test2
3 - test3
4 - test4
5 - test6
and table 2 had:
1 - 4
2 - 5
Then when the query ran, it would only pick up 1 - test, 2 - test2, 3 - test3.
Any ideas. I have tried but with no luck:
SELECT [ID], [txtfield1] FROM table1 WHERE NOT EXISTS (SELECT [idfield] FROM table2)
View 2 Replies
View Related
Jan 10, 2008
hello all,
i've written this query and all was working fine, but.... i added the Where IN statement and no it runs really slow. i have tried using the Where exists option but couldn't get it working.
As i understand it this is probably the worst query to run on a jet database
as it contains subqueries, select Disinct and a Where statement.
any /pointers to speed it up?
thanks all
SELECT LNE_ACTUAL_COST_JOIN.Project_ID, LNE_ACTUAL_COST_JOIN.UID, SUM(LNE_ACTUAL_COST_JOIN.[10/08] ) AS ActualCost, PPE.[Plan at Prior Period End]
FROM LNE_ACTUAL_COST_JOIN RIGHT JOIN
(SELECT DISTINCT LNE_P3e_Activities.Project_ID, LNE_P3e_Activities.UID, LNE_P3e_Activities.UID_Desc, sum(Results_Cost_Next_Period_Activities.Planned_Co st) AS [Plan at Prior Period End]
FROM LNE_P3e_Activities INNER JOIN Results_Cost_Next_Period_Activities
ON (LNE_P3e_Activities.Project_ID = Results_Cost_Next_Period_Activities.Project_ID) AND (LNE_P3e_Activities.Activity_ID = Results_Cost_Next_Period_Activities.Activity_ID)
WHERE LNE_P3e_Activities.Project_ID IN
(SELECT project_ID
FROM Project_List_LNE
WHERE LNE_P3e_Activities.Project_ID = Project_List_LNE.Project_ID ) AND
((Results_Cost_Next_Period_Activities.Year)="07/08") AND ((Results_Cost_Next_Period_Activities.Period)=11)
GROUP BY LNE_P3e_Activities.UID, LNE_P3e_Activities.Project_ID, LNE_P3e_Activities.UID_Desc
)
AS PPE ON (LNE_ACTUAL_COST_JOIN.UID = PPE.UID) AND (LNE_ACTUAL_COST_JOIN.Project_ID = PPE.Project_ID)
GROUP BY LNE_ACTUAL_COST_JOIN.Project_ID, LNE_ACTUAL_COST_JOIN.UID, PPE.[Plan at Prior Period End];
View 1 Replies
View Related
Apr 14, 2005
VB useses the FileExists funcion as follows:
object.FileExists(filespec)
Which returns true or faulse and where filespec is the file name and object is the name of a FileSystemObject.
What I need to know is what exactly a FileSystemObject is and if anyone could possibly give an example piece of code working?
View 2 Replies
View Related
Nov 20, 2006
Hi
I have a problem where a user would enter a project code eg 113-099. I put in a list box that filters all the project codes for instance if the user enters 1 it will show all codes starting with a 1 and every additional number they enter it filters the list box to show which codes already exists! I hope this makes sense.
The problem i have is i need to check when they enter the project code that it is a unique value. The Database developer we got in didnt index this field as no duplicates allowed and as result we have large amount of duplicate project codes.
I have started to experiment with Dlookup but with no great success.
If anyone can help it would be much appreciated as i dont have much experience with access.
The field name on the form is
[forms]![projects_frm].[project_job_number] and the table which stores this information is [projects]
View 4 Replies
View Related
Feb 1, 2006
How to delete table if exist using VBA. I know this was in forum but I can't find the answer. Please help its urgent.
View 8 Replies
View Related
Mar 23, 2006
I have a table (tblSales) with these fields (RecDate, Code, Type, OrderCount).
I also have a linked table (lnkSales) with these fields.
Daily I append the data from the lnkSales to tblSales.
The tblSales table must have a record for each code daily.
These are the codes (01,02,05,07,09,10,15).
I need to automatically add a record for each code that wasn't appended.
For example,
lnkSales contains:
03/22/06 01 Mc 3
03/22/06 02 Mc 1
03/22/06 05 Mc 1
03/22/06 07 Mc 2
03/22/06 10 Mc 1
When appended to tblSales there is no record for code 09 or 15.
I need to add these records to tblSales
03/22/06 09 Mc 0
03/22/06 15 Mc 0
Can someone explain the best way to accomplish this?
Thanks.
View 3 Replies
View Related
Aug 14, 2013
I have a table called 'maintable'. It has 5000 plus entries of employees with different fields. Every Employee has unique ID. One field is date of birth (dob). Normally more than one person can have the same date of birth. A form (maintable1) is created to enter data into this table.
In order to avoid duplicate entry of the same employee again with all his data, I wish to know if the same date of birth (dob) which is being entered now already exists for any employee to verify if the employee being entered is the same, if not then I can enter the data of new employee with the same date of birth.
So basically when I will enter data in a form for the dob field, if the value is the same, then a message that entry already exists, then the 'maintable' may open highlighting the same date of birth entry, so it can be verified if the same person is not entered again.
View 9 Replies
View Related
Aug 12, 2012
Is there any way to check if a particular table already exist in MS Access Database using ACCESS VBA?
Actually I'm creating temp table on the file but I want to check if temp table already exits then need to delete before creating.
e.g. I can check if query defniniton already exists using below code:
Code:
If .DCount("[Name]", "MSysObjects", "Left([Name],1) <> '~' AND [Type] = 5 AND [Name] = '" & strTempQueryName & "' ") <> 0 Then
.DoCmd.DeleteObject acQuery, strTempQueryName
.CurrentDb.QueryDefs.Refresh
End If
View 1 Replies
View Related