| | |
MS Access table connection problem
![]() |
•
•
Join Date: Apr 2007
Posts: 5
Reputation:
Solved Threads: 0
I use a database connection string as below and my program work fine.
Public Function initdb()
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\Masterfile.mdb")
Set rs = db.OpenRecordset("Detail", dbOpenTable)
max = rs.RecordCount
Exit Function
End Function
***********************************
But now I lock the msaccess table ie. Masterfile.mdb with password in order to prevent anyone opening the table and change data inside not through the program, how do I change the connection string so that my code would still work with the protected database.
Any help or suggestion would be highly appreciated.
Zela
Public Function initdb()
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\Masterfile.mdb")
Set rs = db.OpenRecordset("Detail", dbOpenTable)
max = rs.RecordCount
Exit Function
End Function
***********************************
But now I lock the msaccess table ie. Masterfile.mdb with password in order to prevent anyone opening the table and change data inside not through the program, how do I change the connection string so that my code would still work with the protected database.
Any help or suggestion would be highly appreciated.
Zela
•
•
Join Date: Apr 2007
Posts: 5
Reputation:
Solved Threads: 0
I am not sure about the DAO version stuff, what i know is that I use ms access 2002, Office XP, does this help ? like i mention before i need to lock the access table so that the table can only be open through the program. I can lock the database with password, but how do I change/modify the code to open the access table.
Last edited by zela; May 7th, 2009 at 6:54 am. Reason: add word
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
'add Microsoft DAO 3.5 in the project from Reference
Dim myDb as Database
Dim mySet as Recordset
'write in Form Load event
Set myDB=Open Database("Path of the .mdb")
Set Myset=myDb.Open Recordset("TableName",dbopendynaset)
' if you want to display in some text box
TextBox1.text=mySet.Field(0)
TextBox2.Text=mySet.Field(1)
' and so on.
Eidt
mySet.Edit
myset(0)=TextBox1.Text
myset(1)=TextBox2.Text
mySet.Update
mesgbox("Record Updated")
Try this, it may helps you
Dim myDb as Database
Dim mySet as Recordset
'write in Form Load event
Set myDB=Open Database("Path of the .mdb")
Set Myset=myDb.Open Recordset("TableName",dbopendynaset)
' if you want to display in some text box
TextBox1.text=mySet.Field(0)
TextBox2.Text=mySet.Field(1)
' and so on.
Eidt
mySet.Edit
myset(0)=TextBox1.Text
myset(1)=TextBox2.Text
mySet.Update
mesgbox("Record Updated")
Try this, it may helps you
Last edited by jackVB; May 7th, 2009 at 7:18 am.
![]() |
Similar Threads
- database problem (C#)
- Error Microsoft OLE DB/ODBC (0x80004005) Access (ASP)
- Add data from Excel to Access Table (Visual Basic 4 / 5 / 6)
- access and mySql connection combination...plss help (Visual Basic 4 / 5 / 6)
- Need help with ms access and vb.net (VB.NET)
- DataCombo Connection problem (Visual Basic 4 / 5 / 6)
- HIJACKED wireless (Viruses, Spyware and other Nasties)
- Problem with VB.NET and MSAccess (VB.NET)
- Problem with my project (ASP)
- file access problem(access and oracle) (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: downloading
- Next Thread: Update Binary Field in sql server 2000
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





