Hi,
I'm really really stuck on a problem, and hope someone might be able
to help me or suggest a working solution. If someone can I'll pay them
US$15 . I really need an answer as soon as possible thanks.
I've upgraded a VB frontend program with MDI Forms using an Access
backend to a newer version of Vb and Access (have gone from VB4 16bit
to VB5 32bit and Access 2.0 to Access 97). I've left the workgroup
file intact from Access 2.0 as the MS support files say that it isnt
necessary to upgrade this.
I've imported and modified pretty much the whole program into VB5 and
have it at the stage where it does a full compile and some of the
forms and data is working ok.
However on one of the forms, the data control won't accept any
recordsets I try to assign to it through the .RecordSource property.
If i try to assign a recordsource 'sql select' query to the Data
Control it gives me the error:
Record(s) can't be read; no read permission on 'tbl_AssetStatus'.
'3112'
But the funny thing is if I just create a recordset through the DAO
OpenRecordset method it will allow me to read the data contained in
the table and fields.
e.g. set rs = db.OpenRecordset(qryJournal)
debug.print rs("fieldname").value
I understand i have to setup the DBEngine properties according to my
workgroup and login/password properties. Here is the code preceeding
the recordsource assignment into the data control where I do this.
This is where i give it passwords and user name.
(first loaded module)
DBEngine.DefaultUser = "theuser"
DBEngine.DefaultPassword = "thepassword"
wwpath = "J:\GRP\PATH2DB"
DBEngine.SystemDB = wwpath & "\wrkwise.mda"
(second module)
Databasename$ = "J:\GRP\PATH2DB\ASSETDB.MDB"
Set AssetDB = DBEngine.OpenDatabase(DatabaseName$, , , "UID = theuser;
PWD = thepassword;")
(Form Load event - for the MDI Child form)
datJournal.DatabaseName = AssetDB.Name
datJournal.RecordSource = qryJournal 'query is at bottom of msg
datJournal.Refresh <------ This is where error occurs.
I can open the database manually through Access and enter the same
username and password as above and can read all the tables within the
database. The database also contains a linked table, and like wise i
can open the linked table and read it fine.
Using Dao 2.5/3.5 compatiblity layer.
Thanks in advance for any help
I just did another little test, i gave it a false login name and
password like so;
DBEngine.OpenDatabase(DatabaseName$, , , "UID = wronguser; PWD =
wrongpwd;")
And i get a different error it says:
The SELECT statement includes a reserved word or an argument name that
is misspelled or missing, or the punctuation is incorrect.
If anyone can spot the obvious please let me know, as i have been down
that road to no avail.
qryJournal = "SELECT DISTINCTROW tbl_AssetJournal.Asset_Number AS
[Asset No], tbl_AssetJournal.Asset_Name AS Name, "
qryJournal = qryJournal & "tbl_AssetJournal.Asset_Description AS
Description, tbl_AssetJournal.Make, tbl_AssetJournal.Model_Number AS "
qryJournal = qryJournal & "[Model No],
tbl_AssetJournal.Serial_Number AS [Serial No],
tbl_AssetJournal.Identification_Marks AS [ID Marks], "
qryJournal = qryJournal & "tbl_AssetJournal.Account_Code AS
[Account Code], tbl_AssetJournal.Centre_Code AS [Centre Code], "
qryJournal = qryJournal & "tbl_AssetJournal.Supplier,
tbl_AssetJournal.Order_Number AS [Order No],
tbl_AssetJournal.Delivery_Date AS "
qryJournal = qryJournal & "[Delivery Date],
tbl_AssetJournal.Warranty_Date AS [Warranty Date],
tbl_AssetJournal.Cost, "
qryJournal = qryJournal & "tbl_AssetJournal.Service_Contractor AS
[Service Contractor], tbl_AssetJournal.Location_Code AS [Location "
qryJournal = qryJournal & "Code], tbl_AssetJournal.Section_Code AS
[Section Code], tbl_AssetJournal.Last_Stocktake_Date AS [Stocktake "
qryJournal = qryJournal & "Date],
tbl_AssetJournal.Brisbane_Reference_Number AS [Brisbane Ref No],
tbl_AssetAccessory.Parent_Number "
qryJournal = qryJournal & "AS [Parent Accessories],
[tblPersonInfo].[FIRST_NAME] & " & """" & " " & """" & " &
[tblPersonInfo].[LAST_NAME] AS [Record "
qryJournal = qryJournal & "Originator],
tbl_AssetJournal.Modification_Type AS [Modification Type],
tbl_AssetJournal.Modification_Date AS "
qryJournal = qryJournal & "[Modification Date],
[tblPersonInfo].[FIRST_NAME] & " & """" & " " & """" & " &
[tblPersonInfo].[LAST_NAME] AS [Modifiers Name] "
qryJournal = qryJournal & "FROM (tblPersonInfo RIGHT JOIN
tbl_AssetJournal ON (tblPersonInfo.CARD_ID =
tbl_AssetJournal.Modifiers_ID) "
qryJournal = qryJournal & "AND (tblPersonInfo.CARD_ID =
tbl_AssetJournal.Record_Originator)) LEFT JOIN tbl_AssetAccessory ON "
qryJournal = qryJournal & "tbl_AssetJournal.Asset_Number =
tbl_AssetAccessory.Asset_Number "
qryJournal = qryJournal & "ORDER BY tbl_AssetJournal.Asset_Number,
tbl_AssetJournal.Modification_Date DESC" |