Problem With SQL Obtaining MsysObjects
Sep 25, 2005
Hello,
I've got a workaround for the SQL of obtaining a count of tables matching a certain name-style. Ideally, I want to use the Like function (sql2) as it codes more simply, but found that the query doesn't work. As a workaround, I rewrote with a string comparison using the Left function sql1.
My question is: What is wrong with sql2?
When I paste the SQL into the Query Designer it works, yet when I debug in module code form, it fails.
Any ideas?
Regards.
Private Function getTableName(strName As String) As String
'---------------------------------------------------------------------
' Purpose
' This function is used to create a new table name. First it looks up
' all the table names in the database matching the passed in variable
' name, and then returns an incremented version of the name.
'---------------------------------------------------------------------
' Returns
' Table name as string.
'---------------------------------------------------------------------
Dim sql1 As String, sql2 As String, rst As New ADODB.Recordset, n As Byte
' Get number of characters for passed-in variable.
n = Len(strName)
sql1 = "SELECT Name FROM MsysObjects WHERE left(Name," & n & ")=left('" & strName & _
"'," & n & ") AND (Type=1)"
sql2 = "SELECT Name FROM MsysObjects WHERE (Name Like '" & strName & "*') AND (Type=1)"
rst.Open sql2, CurrentProject.Connection, adOpenKeyset
Debug.Print sql2
Debug.Print rst.RecordCount
If rst.RecordCount >=1 Then
getTableName = strName & rst.RecordCount + 1
Else
getTableName = strName
End If
rst.Close
Set rst = Nothing
End Function
View Replies
ADVERTISEMENT
Dec 7, 2005
Hi All,
Long time no see y'all...
Question: is it possible to obtain a list with all the Access based System or User DSN entries on a system? First I don't know how to get such a list at all, and second I don't want to bother the users with non-Access entries - they're confused enough as it is.
Any help appreciated & regards,
Michiel
View 1 Replies
View Related
Dec 10, 2007
Hello to you all...
I am just after a bit of assitance if anyone can kindly help?
Basically, I need to redevelop a Complaints database for my employer as the current one is no longer fit for purpose. The current database is a FE/BE database and users are required to login with a username and password. This causes me a massive headache as users constantly forget their password and email me to reset it. I had included a password reminder form which emailed users their password if they got their pre-defined security questions correct but our business standards dept did not want us to store personal data for the reminder questions. Is there a way that the database can obtain the users network login ID from windows without too much difficulty?? We had something similar in a previous database but it dipped into the system registry and our IT dept had a fit when the found out....not surprisingly. :-)
Thanks people. Have a great day!
View 4 Replies
View Related
Feb 23, 2006
Well, the title says it all.
Is it possible to amend this hidden table? It is for my ODBC links, I would like to amend (enmass) where it is linked to and the table name. If I could amend this table, it would only take seconds.
View 1 Replies
View Related
Mar 5, 2006
Hola senor y senora.
I'm new here.
I am currently working on MS Access Project and I needed help from you guys. :o I have done smoothly so far, but now I'm stuck at this query:
SELECT [MSysObjects].[Name] AS ObjectName
FROM MSysObjects
WHERE (((IIF(Left([Name],4)="mis_",[Name],""))<>""))
GROUP BY [MSysObjects].[Name],Left([Name],4),[MSysObjects].[Type]
HAVING (((Left([Name],4))<>"MSys")
AND ((MSysObjects.Type)=1))
OR (((MSysObjects.Type)=-32768))
ORDER BY [MSysObjects].[Name];
Previously, there was somebody doing this project, and so I have to sort of enhance this project by moving a few buttons here and there. That query lists out all the tables that had been filtered. So, I am stuck now on what does the query actually means. I also had tried the query by creating a fake Query and type out the SQL but I still cannot understand how am I to go about re-using the query. Do hope anyone of you could help me out and explain to me. (Pardon me if I really sound ignorant. :o )
View 5 Replies
View Related
Jul 23, 2007
Hi,
I have a table containing the following fields;
ProductID (UniqueID)
Date
Price
Each day some, but not all, of the products in this table have their prices updated.
When I write a query how can I ensure that the latest price is recalled ?
Any tips greatfully received.
View 2 Replies
View Related
May 23, 2005
In the midst of importing and deleting forms and the underlying code, I've got some rogue forms in the MSysObjects table that I want to get rid of, but can't figure out how. They look just like regular forms in the table, but have names like "~TMPCLP411521", and some of the controls are in there, too, with names like "~sq_c~TMPCLP411521~sq_ccboPayTypeID". Can anybody help me get rid of these things? Or am I stuck with them? Thanks.
View 3 Replies
View Related
Jul 22, 2014
I have three tables A, B and C.
I want to build a query that displays three separate totals: Total of A, Total of B and Total of C.
When I try to do this, the query has a weird behaviour summing the totals of the totals of the totals, and I don't know why .
I'm attaching a really basic sample of what's happening, where totals SHOULD be $4, $8 and $16 instead of $16, $32 and $64.
View 14 Replies
View Related
May 28, 2015
I have big problem with connection between ODBC and Access 2007. Everything is linked correctly but I have problem with separator in decimal field. In my country this separator is "," not ".". I found information about connection in MSysObjects.connect table that
Code:
...;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;...
I found somewhere that I need to change NUM value from NLS (default) to MS. Do you know how to edit this value? For example Access 2007 see value "123.8" (so it is in my country "123,8" ) like "1238"
View 8 Replies
View Related
Apr 10, 2014
I want to use the create date of a file which is stored as a linked table in my Access 2010 database. I have attempted this by creating a query (qrysysObjects) using the MsysObjects and that gives me the filename of the linked tables, well almost - a few are csv files and this does not have the file name in the database field text, but I have found it in the foreignname field except it is name#csv rather than name.csv so I can't simply concatenate this in a query.
I know there is a function called FileDateTime which you can use in vba or a query but can you use a variable with this rather than the actual path name? I tried this in the query qrySysObjects but it said unknown function.
View 2 Replies
View Related
Jun 18, 2015
I set up several combo boxes to display Tables from msysobjects. The record source is using a WHERE clause to display certain tables both Linked and Local. Occasionally, when clicking the dropdown arrow, the box only displays local tables. This situation seems not to matter whether tables have been newly linked or unlinked. despite having both a me.requery and a me.refresh in the code and/or even clicking the Refresh All button on the ribbon menu, the form does not seem to update the combo box to display both linked and local tables.
In further testing, it seems that it is not a form issue because I took the SQL statement I used as the record source and created a new query with the sql string. The query behaved the same as the combo box, only listing out local tables.
My current work around is to close the database and reopen, then all is well. Hopefully there is another way to get the linked tables listed without this drastic step.
Don't think it's necessary, but here is the sql statement. Type 6 is linked.
Code:
SELECT msysobjects.name
FROM msysobjects
WHERE msysobjects.[flags] = 0
AND msysobjects.[type] in (1, 6)
AND Right([name],7)<>'_SOURCE'
AND Right([name],4)<>'_OUT'
AND msysobjects.name not in ('tblImport','tblImportFormats','tblUniversal') OR msysobjects.database=gblprojectname()
ORDER BY msysobjects.name, Right([name],7);
View 9 Replies
View Related
Dec 11, 2013
Due to software licensing restrictions, my (Access 2007) development pc is NOT (may not be) connected to the network.The user pc's are all connected to the network.The network pc's only gets Access 2007 Runtime.The Front-end accde will be located at C:mydbFE heFE.accde on each user's pc.The Back-end will be located at X:mydbBE heBE.accdb (network share).
Currently (during development) the Front-end and Back-end is at C:mydbDEVFE and C:mydbDEVBE respectively - on my development pc, and the linked tables are pointing to C:mydebDEVBE.Now that I'm ready to distribute the database to the user pc's, I obviously need the Front-end's Linked Tables to point to X:mydbBE heBE.accdb
Where does Access2007 store the path to the Linked-Tables ? Is there a way I can change this path manually before making the accde ?I noticed that the path to the linked tables appear in the (hidden) MSysObjects table, but I do not want to mess with it until I know what the solution is.
View 8 Replies
View Related
Feb 11, 2015
In our Student Administration database, we have a Student Evaluation Report which prints a 1 page per student report in memo like format. The instructor had previously input rating numbers (4=Best, 1=Worst) for 9 categories for each student via a database form into the Evaluations Table.
Two other elements of the rating are an Attendance based on number of days absent and a Grade Point Average (GPA) calculated from the student's test scores. The instructor then prints and reviews the report with each student.
There is an Evaluations Parameter table which has the following fields:
Field
Description
ID
The autonum key field.
Class
eg., 2015-1
Evaluation Number
A single digit (eg., 1, 2). There may be more than 1 evaluation for each class.
EffectiveDate
The "as of" date of the evaluation.
There are then several other tables that are input to a query that will be the record source for the report:
Table
Purpose/Data
Students
Student Name, Class
Absence
Has a record for each student's absence with date and a 1 or .5 indicating a whole or half day absent.
Test Grades
Has a record with each student's test results with date and score.
Evaluations
Holds the rating score for each of the 9 rating categories.
The Student Evaluation report is launched from an unbound Reports menu form via a button. On the Reports menu form I wish to have controls for the user to select which evaluation to report on. The Absence and Test Grade information needs to include records that are <= the EffectiveDate in the Evaluation Parameter table. The Evaluations records need to match the Class and Evaluation Number in the Evaluations Parameter table.
I would like the user to be able to select the Evaluation Parameter via a combo box vs. specifying the Class, Evaluation Number and Effective Date separately and then have the query record source for the report use those two fields as criteria. But my limited understanding of the Combo box indicates that only 1 field from the lookup query of the Evaluations Parameter table can be stored in the control whereas I need 3 (Class Evaluation Number and EffectiveDate).
How the user can select the desired Evaluation Parameter record on the Reports menu form and use the 3 fields from the selected record as criteria in the report's record source query.
View 10 Replies
View Related
Oct 10, 2013
I have a db that is having some strange speed issues on some very basic queries. Objects that have a rowsource/recordsource with a SQL statment in particular are really slow to populate. Likewise on deactivate/activate the report query seems to reload. I've put breakpoints in every object event with no stops out of the ordinary, and nothing seems unusual.
While I know MSysObjects is a user read-only table, I came across some records that reference objects that no longer exist in the front-end. Is this table cumulative? Is there any way to purge the deprecated records? I tried to turn on then turn off autocorrect features hoping that would trigger it to repopulate, but no luck.
I'm thinking this may be the source of the issue. Perhaps if it is looking for an object that it can not find (especially the ~sq_ unsaved queries) then it's looking to the wrong place on a lostfocus/activate/deactivate or similar event.
Some history on this file, it has been through many versions of Access starting with 2003, which I think is part of the issue as well. Shy of looping every object and replicating the read-write properties, I'm not sure where else to go with this.
View 2 Replies
View Related