Access Reformats My SQL - And Then It No Longer Works!
Apr 5, 2006
Situation: I have written a fairly straight forward nested query which aggregates sales & activity data (num_calls, date, etc.) by customer specialty (CODE_ESP_ACC1) in a single query. The SQL I have written to achieve this is as follows:
SELECT Q002.GP, Sum(Q002.Num_Calls) AS Total_Calls
FROM (SELECT Q001.CODE_ESP_ACC1, Count(Q001.ACT_ID) AS [Num_Calls], Iif([Q001].[code_esp_acc1]="MG" or [q001].[code_esp_acc1]="MF",1,0) AS GP
FROM (SELECT [06 Act 2005 Hosp - IM].ACT_ID, [06 Act 2005 Hosp - IM].TER, [06 Act 2005 Hosp - IM].ACC_ID, [11 Physicians with main specialty].CODE_ESP_ACC1, [06 Act 2005 Hosp - IM].DATE
FROM [06 Act 2005 Hosp - IM] LEFT JOIN [11 Physicians with main specialty] ON [06 Act 2005 Hosp - IM].ACC_ID = [11 Physicians with main specialty].ID_ACC
WHERE ((([06 Act 2005 Hosp - IM].POSITION)=1))) AS Q001
GROUP BY q001.code_esp_acc1, Iif([q001].[code_esp_acc1]="MG" Or [code_esp_acc1]="MF",1,0)
HAVING (((Q001.code_esp_acc1) Is Not Null))) AS Q002
GROUP BY Q002.GP;
This works absolutely fine. I can save this query and run it many times without problems. However, if I then re-enter SQL edit view, Access reformats it as follows:
SELECT Q002.GP, Sum(Q002.Num_Calls) AS Total_Calls
FROM [SELECT Q001.CODE_ESP_ACC1, Count(Q001.ACT_ID) AS [Num_Calls], Iif([Q001].[code_esp_acc1]="MG" or [q001].[code_esp_acc1]="MF",1,0) AS GP
FROM (SELECT [06 Act 2005 Hosp - IM].ACT_ID, [06 Act 2005 Hosp - IM].TER, [06 Act 2005 Hosp - IM].ACC_ID, [11 Physicians with main specialty].CODE_ESP_ACC1, [06 Act 2005 Hosp - IM].DATE
FROM [06 Act 2005 Hosp - IM] LEFT JOIN [11 Physicians with main specialty] ON [06 Act 2005 Hosp - IM].ACC_ID = [11 Physicians with main specialty].ID_ACC
WHERE ((([06 Act 2005 Hosp - IM].POSITION)=1))) AS Q001
GROUP BY q001.code_esp_acc1, Iif([q001].[code_esp_acc1]="MG" Or [code_esp_acc1]="MF",1,0)
HAVING (((Q001.code_esp_acc1) Is Not Null))]. AS Q002
GROUP BY Q002.GP;
... and this no longer works (syntax error in FROM statement).
To save you sifting through the SQL, the error is caused by Access replacing the soft brackets () aroung the outermost FROM statement with an object identifier-style hard bracket []. - specifically, the outermost SELECT statement now reads
SELECT Q002.GP, Sum(Q002.Num_Calls) AS Total_Calls
FROM [
instead of
SELECT Q002.GP, Sum(Q002.Num_Calls) AS Total_Calls
FROM (
and the alias for the subquery reads
]. AS Q002
instead of
) AS Q002
Changing the Access alterations back to my original fixes this problem - so the problem is more an annoyance than a disaster. However, I have no idea why Access is doing this to my query, nor how to prevent it from doing so. Does anybody have any experience of this behaviour in Access and any ideas of how to fix it?
Help! Replies appreciated.
View Replies
ADVERTISEMENT
Oct 24, 2005
I'm using Access 2000 along with Oulook 2003. Since we changed email servers, the send report no longer works. The addresses no longer appear to be valid. I can manually put all the names in every time an email is sent, but that is defeating the purpose!
I even tried changing the addresses to what an outsider would use rather than our internal name list; (milko@valspar.com instead of Mary Ilko) but this didn't work either.
Here's the code:
Private Sub cmdMailApproval_Click()
OnError GoTo Err_cmdMailApprovalClick
Dim stDocName As String
stDocName="rptForApprovalReport"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport stDocName, acViewPreview,, "[Batch#]=forms![frmInbound]![Batch#]"
DoCmd.SendObject acSendReport, StDocName, acFormatSNP, "FirstName Lastname",,,"Pre SHip Approval", "Please see the attached."
DoCmd.SendObject
Thanks in advance for your help!
Mary :o
View 1 Replies
View Related
Jul 27, 2014
i wish to combine multiple fields (there are no fixed number of fields, they vary depending on the data, so i guess union queries are out of the question) into one large field. For example:
TABLE 1:
PNumber
PName
C1
C2
C3
1
AAA
0.1
0.2
0.3
2
BBB
0.4
0.5
0.6
So i wish to combine the fields C1, C2 and C3 into a larger fields containing all the data. So considering the example above, it should look like this:
TABLE 2:
PNumber
PName
C1+C2+C3
1
AAA
0.1
1
AAA
0.2
1
AAA
0.3
2
BBB
0.4
2
BBB
0.5
2
BBB
0.6
I plan on entering data into TABLE 1 using a form and running a query, or some code etc so that it looks like TABLE 2.
View 14 Replies
View Related
Aug 22, 2006
I'm using Access 2003 with a frontend/backend database on a network. Several of our forms have image controls with links to a folder of JPG images, and these have worked fine for months. I have followed the recommended linking method described here (http://www.access-programmers.co.uk/forums/showthread.php?t=92837&highlight=jpg+link) and as I mentioned everything has worked fine until recently. Foolish me decided to try out Office 2007 beta for a few days but uninstalled it after a few days. Now, on my computer only back on Access 2003, whenever I try to open one of the forms that previously worked I get an error message saying "Access does not support the format of the file '....jpg. Try converting the file to BMP or GIF format". Copies of the same frontend works fine on other work stations, and I can open jpgs in Word and Excel. Or, to be even more frustrating, an embedded jpg will show up fine in my copy of the program - it's only linked jpgs that are rejected. I first repaired Office 2003, then completed unintalled and reinstalled it - same error message. 2 hours with MS tech support has been likewise futile. I'm guessing it has to be some kind of registry error, but nothing I seem to do makes a difference. Any suggestions at all will be greatly appreciated, because my next step is a complete format and clean install of everything.
View 2 Replies
View Related
Jun 29, 2005
I have adp projects that I connect to an SQL server that is remote. All worked fine until I had to do a windows repair. Now I open the project and it comes up as disonnected. It will not let me open any other box like connections. If I try that it says "Microsoft Access can not log on to server". If I try to start a new adp same message. I am the admin on my XP pro machine.
View 1 Replies
View Related
Dec 12, 2005
I have built a rather extensive database using Access 2000. When I install it on an Access 2003-enabled machine, the first time it is opened, the user is presented with the following errorbox:
"An error occurred and this feature is no longer functioning properly. Would you like to repair this feature now?"
At this point, clicking "Yes" results in an update the installation of Access 2003. Then the database must be opened manually again. Then, the following is displayed:
"Module not found."
Closing the database at this point and then opening it again results in a normally functioning database.
I have several questions:
1) What is the feature that is no longer functioning properly?
2) What is updated when the installation exec runs?
3) What module is not found? I assume this is one of the VBA modules that I've created, but I've check all 62 of them and they all seem to be there available.
4) My first guess was a reference problem, but I've checked the references used and all are available, as far as I can tell. These are the ones that I have referenced: VBE6.DLL, MSACC9.OLB, DAO360.DLL, STDOLE2.TLB, MSCAL.OCX, MSADO25.TLB, MSO9.DLL.
5) After getting the first error - the one about nonfunctioning feature, I clicked "no" to the repair now question. This does nothing except the database remains open. At this point, I opened the code and tried to compile, but I get the "module not found error". I likewise tried to set a breakpoint in one of the first modules and I get the same result.
6) I even tried to copy the forms, queries, tables, and reports into a blank database with no references and no other extraneous code and received the same result.
This site has been extremely helpful in the past and I am really relying on you guys again for the same stupendous help now.
Forever in your debt,
Tom
View 5 Replies
View Related
Aug 16, 2005
I have installed on my PC, WindowsXP sp.1, MSaccess versions 97 and XP.
After I have tested some databases, MSaccess 97 don't works successfully more, but XP version works good. I can't modify files mdb. Access works like in run-time mode: bars and commands reduced, standard icon of access absent, database window absent, ecc.
If macro autoexec or a form that play at the start of mdb are present, mdb works but it is impossibile to modify it. Otherwise mdb dont works, I can see access window with only menu files and window.
I have removed access and after yet installed it, but it don't work successfully.
maybe other application leaved files (or modification in file registry) that install procedure of access97 cant rewrite? And that dispose access 97 to work in run-time mode (or like)?
I am hopeless. Can You help me? Can you give me a list of files to remove, or list of modification to do in registry?
Danit :
View 4 Replies
View Related
Aug 25, 2004
Can anyone recommend two good books which it should include the knowledge from Beginner to Advance level.
1. Microsoft Access
2. VBA to work with Access
View 1 Replies
View Related
Sep 2, 2004
I have an Excel macro that formats a chart and I have tried copying and adapting it for Access.
The following line is executed OK in Excel :
Select Case ActiveChart.SeriesCollection(Counter).Name
I have changed it to the followig for Access
Select Case Me!DERVGraph.Object.Application.Chart.SeriesCollec tion(Counter).Name
but in Access I get an error 'Object does not support this property or method.
(The space shown in SeriesCollec tion above is a screen bug)
Any ideas?
Thanks
View 8 Replies
View Related
Jun 24, 2005
Hello..
I got the following code from this forum to create shortcut on the desktop..
==================
Set objShell = New WSHShell
Set objShortcut = objShell.CreateShortcut(objShell.SpecialFolders("AllUsersDesktop") & "" & sShortcut)
objShortcut.TargetPath = sDB
objShortcut.WindowStyle = "3"
objShortcut.SAVE
=================
I have Access 2003..but file format is 2000 because others have access 2000.
This code works great on my machine..but getting error on access 2000 machine..It does not recognize "New WSHShell" in the above code.
-------------------error message
Compile Error:
User-defined type not defined
-------------------
Any references needs to be added?
Please help...Thanks..
View 1 Replies
View Related
Jan 14, 2006
I created a DB program for my last job that resided on a stand alone PC. It has the Access generated user level security (so there's a "secured.mdb" file) and can only be opened via the desktop icon. In the past, when I copeid the db to a flash drive, took it home to work on it, it always said I didn't have permissions to run it unless I placed it in the right spot on my computer where I've got it set up with a secured file and the desktop to open it.
Yesterday, I noticed that I can now open it anywhere, including my laptop, and it just opens. My concern is, I don't trust the business where the program is being used to not take it and call it their own (I trust the management team, however).
ANy ideas why it no longer looks for the user level security now?
I'm running XP Pro on both machines, Access 2002 on the desktop and 2003 on the laptop.
Thanks.
View 10 Replies
View Related
Sep 29, 2005
Not exactly sure if we has anything to do with sql server so sorry if it isnt strictly relevant.
I have a database on sql server and am using an access data project as the front end. Have finsihed this and is working fine till I try and use it on another computer on the network. It still connects to the database fine (well on most machines on the network not sure why not on the others) but the problem is access functions in my reports and forms seem to have stopped working and show up as ?#name
Examples of the kind of functions I am talking about are
=Format$([DateFrom],"Long Date")
=[SumOfMinutes]60 & Format([SumOfMinutes] Mod 60,":00")
any suggestions?
View 1 Replies
View Related
Apr 6, 2006
I have a replica database in Access 2000.
I changed a form in the design master that had nothing to do with the date or a date field. Everything appeared fine.
Now I updated the replicas, and an error is happening on all replicas as well as the design master. Any reference to Date() or Now() causes errors.
If it's a field on a form it has an #Name error. If Date() or Now() is on a report, a popup to enter parameters appear for the date. This database with these codes have been working for years.
Is it safe to say it's no longer recognizing Date() or Now() ?
Any ideas on a fix?
View 2 Replies
View Related
Nov 7, 2006
I recently upgraded to Access XP (2002) and now my application will not respond to F11 to get into the development window. This application has two mdb files. One is the database (with security), and the other one has the forms, queries, reports and links to the tables in the first mdb.
View 12 Replies
View Related
Jan 8, 2008
I developed a database in 2005 and used the 'Left' function in many of the queries to obtain the the correct text for output to reports. The database worked extremely well for a year and a half.
I have not accessed it for the past year. Recently I opened the database for use with a new project and I keep receiving the error message:
! Undefined function 'Left' in expression.
I haven't changed any of the expressions and do not understand why this funtion no longer works.
Any ideas?
Thanks
View 5 Replies
View Related
Mar 1, 2006
Several years ago, my colleague and I built some databases (using Access 97, if it matters). We are both responsible for the maintenance of them.
Recently, the hard drive in my PC crashed, and the IT group replaced it. Now, when I open one of the databases, I cannot see all of the Forms, Tables, etc. Thinking the database had been corrupted, I asked my colleague to open it on his machine. Everything was there, and can be viewed from his PC.
All was well until my hard drive was replaced. Has anyone seen this before? Any help will be greatly appreciated.
View 1 Replies
View Related
Feb 24, 2015
I have been using this export function for the longest time and today it is giving me an error:Object invalid or no longer set.
Code:
On Error GoTo Err_cmdTest_Click
'Must 1st set a Reference to the Microsoft Office XX.X Object Library
Dim dlgOpen As FileDialog
Dim strExportPath As String
Const conOBJECT_TO_EXPORT As String = "EXPORT"
[code]....
View 5 Replies
View Related
Jul 4, 2014
I have a large spreadsheet with one column of information which is longer than what access accepts as long text. So when I convert the spreadsheet to access all the large boxes of information are shortened so that I am losing a lot of information.
View 1 Replies
View Related
Feb 24, 2015
I have been using this export function for the longest time and today it is giving me an error:
Object invalid or no longer set.
Export code:
Code:
On Error GoTo Err_cmdTest_Click
'Must 1st set a Reference to the Microsoft Office XX.X Object Library
Dim dlgOpen As FileDialog
Dim strExportPath As String
Const conOBJECT_TO_EXPORT As String = "EXPORT"
[code]....
View 10 Replies
View Related
Apr 30, 2013
I am using an application that uses an Access database, and I believe the original database was created in the 97 version. The application queries the database and allows a person to view the data in the database to select a particular instrument to test. When the MS Office was upgraded by our IT we are no longer able to view the data in application. The fields, rows, and columns appear, but the numbers and letters are not visible. The data is really there, but can't be seen.
I have attached a screenshot of the view that shows the white columns and rows.
View 4 Replies
View Related
Sep 27, 2005
I have an application that inserts records to a database, and it works perfectly on mysql
when i try to insert the records on access after inserting 340 records i get this error message that says
ERROR [HY000][Microsoft][ODBC Microsoft Access Driver] Object invalid or no longer set.
Is there any reason why i'm getting this message?
I'm connecting fine to the database because i'm inserting records, but it suddenly stops and i don't know why
View 3 Replies
View Related
Jul 21, 2006
Hi all,
I have an Access 2002 (SP3) frontend and SQL 2000 (SP3a) backend.
2 sites, 2 SQL servers ( identical hardware and software).
Replication using Push Merge every 5 minutes.
10 users at 1 site and 15 at the other with Access 2002 frontend stored locally on each users PC.
I get random 'object invalid or no longer set' messages just appearing on the workstation screen without the operator doing anything. about 3 or 4 a week, but not on the same workstation at 1 of the sites only, but only during the working hours of the other site. We have out of hours users who never experience this issue.
Occasionally the error is preceeded by a SQL ODBC connectivity error but this rare.
I had been informed it was network issue but I have been running continuous
ping from a suspect workstation to the sql server and back.
When the error occurs there are NO dropouts in the pings.
It doesn't follow volume of data changes either as one site can make hundreds of changes and we don't get the error and then it can be after 10 changes the error occurs.
I have been researching this now for about 2 weeks to no avail, if anyone can point me in the direction of good resources you will make my year. :D
View 4 Replies
View Related
Dec 14, 2004
I need a field to permit only numbers. Upon selecting number for the data type I select Long Integer for a longer number... But it only allows 9 digits.. I need it to allow to enter in longer numbers... Any help?
Thank you very much in avdance
View 9 Replies
View Related
Feb 22, 2008
Hi,
I have been using the following query, literally for years, without any changes. I run it from code using db.execute, and I do use the dbfailonerror option.
UPDATE TST3 SET [date] = Mid([timedate],8,2) & '/' & Mid([timedate],10,2) & '/' & Right([timedate],4), [time] = Left([timedate],2) & ':' & Mid([timedate],3,2) & ':' & Mid([timedate],5,2), Serial = [serial] & '3';
One of the things it does is to add a '3' to the end of the [serial]. [serial] is the primary key in the TST3 table. You might think that there would be a problem if, say, I have a list of serials containing
35
56
1
13
and I'm trying to update them to
353
563
13
133
But this has worked OK in the past. NOW I'm getting a KV Error when it tries to update the 1 to 13, because there's already a 13 in the table.
Even stranger, when the query fails, all the rows BEFORE the offending record DO get updated. So the query fails, and I end up with:
353
563
1
13
(and yes, I DO have dbfailonerror set)
So, it looks to me as if update queries are no longer running as transactions.
I am pretty certain that action queries have always been run transaction-wise in the past... if the query fails, the whole thing should fail. WHY is the transaction processing no longer working for this update query? Has anyone else noticed this?
I recently ran microsoft update and am now running
Access 2002 (10.6771.6830) SP3.
View 7 Replies
View Related
Aug 11, 2013
I have made a form with a main form and two nested subforms. The main form and subforms display data to be edited - fields in which data can be added, but no new records need be added. I and two other users have used this form for about two months. Now when we go to enter data, we can still navigate the form but our changes to the fields in question are no longer saved.
View 2 Replies
View Related
Aug 15, 2013
Periodoically, the "Save Changes?" warning that pops when closing a query whose design has changed stops popping up, and the changes are automatically saved. I've tried going into the immediate window to change SetWarnings to True, but that doesn't fix the issue. (Further, I've scoured my code for instances of "DoCmd.SetWarnings False" to make sure that they are always followed by a "Docmd.SetWarnings True" in the Exit lines.
I've tried searching a number of different sights, and all I can find are instances of people talking about wanting to disable the Query Action warnings, which I don't want to do. I just want to be able to fiddle with queries, but then close them without saving in case I butcher something. I could create a copy of the query and fiddle with that, but I shouldn't have to...
View 13 Replies
View Related