Access A Microsoft Access Database
Hi,I am trying to connect to an Access database using ADO in visual basic. Can anyone help me with this. I don't know how to compose the connection string.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can ASP & VB6.0 Access Microsoft Access Database At The Same Time?
I am a student currently doing a project that took about eight months. Currently, I am facing a big problem concerning Microsoft Access database. My project is due in the end of this June month.
I am developing an application called Library System that uses Visual Basic 6.0 as the program that handles borrow & return, extension of borrow date, reservation of books...etc and another web application ASP that handles Reservation and checking book status. The database in use is Microsoft Access 2000 which resides on the machine where the Visual Basic built program is used.
My problem is that when I opened the Visual Basic application, I can't use the ASP. I get the error:
"file in use"
in the ASP error page since both VB6.0 and ASP are accessing the Microsoft Access at the same time.
My question is can I get both applications (Visual Basic 6.0 & ASP) to be able to access the Ms. Access 2000 database at the same time? Please, I am VERY DESPERATE. My project is to be submitted soon.
Importing Microsoft Excel Files Into Microsoft Access Database?
Hello, I was wondering how to automate Microsoft Access to import a Microsoft Excel File? I can do it normally, but I want to know how (or what commands to use) so that my Visual Basic program will create a Microsoft Access database from a Microsoft Excel spreadsheet internally?
Any help will be appreciated - Thanks.
Microsoft Access Database
I have program where the database store as table in Microsoft Access database.
If I do package and deployment Wizard, Does I have to copy the Microsoft Access database that contains password table to target machine or it also include during package and deployment Wizard ?
Does Client Machine need to be install Mircosoft Access software?
Microsoft Access Database
In my application I use Microsoft Access database.
I want users to access this database using my application.
But I don’t want users to access the database
What are the available methods to do this …
SQL In VB6.0 For Accesing Microsoft Access Database
Can you please take a look at the code below and tell me what is wrong:
demand = "SELECT [Tabelle Kundenanschriften nach KD Nr].[Kunde] "
demand = demand + " FROM [Tabelle Kundenanschriften nach KD Nr] "
demand = demand + " WHERE ([Projekt].[Datum Bestellung]>= #" + FirstDate.Value + "#) AND "
demand = demand + " ([Projekt].[Datum Bestellung]<= #" + SecondDate.Value + "#)"
I think my error is when comparing dates (row 3 and 4). And another question: I work with two tables connected through a field customerID. Do I need to put the condition that the customerID in one table to be the same as in the other table or this is done automaticaly?
Sharing A Microsoft Access Database
Hi,
I have just finished my first database application using VB6 and Microsoft Access 2000.
I have a major problem. I placed the complete program on the File Server. My Application is called "Autohouse Solution". I have a M: mapped on all machines to the server.
When I run the application as standalone, it runs fine.
When i add a record it appears on the customers list as usual.
Today, I ran a test with the application. I opened the application on 2 machines - Machine1 (user1) and Machine2 (user2).
User1 opens the customers form list. And User2 opens the customers form list.
When User1 adds customer it is not displayed as expected, however the list is not displayed on customer2 when he clicks refresh. Both applications are pointing to the same database. And am refreshing the recordset.
I closed the customers form on both machines and re-open them. Still only the new customer appears only on User1 (the one who added the customer) but not on machine2.
Someone told me this was because I have to compile the MDB as an MDE file in order to be sharable. Why is this happening?
The amazing thing was that the database did not contain the new customer record I added, however it displayed on Machine 1 and Not machine2. What is happening???
This application is due tommorrow! Please Help my programming career before it turns into a nightmare!!
Microsoft Access Database On CD Problem
I made one program that converts a large text file into MS ACCESS format (97) mode 4. I have another program that is to open the access file and bind a text box and rich text box to the data.
This program works fine when it's on a writeable filesystem. When I copy the executable and mdb file to the cd- It can't open it.
I get the following error. Microsoft Jet Engine cannot open the file f:purge.mdb, It is already opened exclusively or you need permission to view the data.
How can I open a database on a cd without getting that error since it's a read only filesystem?
Jeremy
Microsoft Access - Vb Database Problem
I made a "very" simple database using Microsoft Access 2000. Then I add a data control in my vb form.....in the "database name", I put the source for the database I created, and then I go to the "record source", and when I click on the arrow, to add a record, I get an error message saying "Unrecognizable database format".
This only happens with the databases I create..all the other databases (biblio.mdb, and others that I have downloaded) work fine. Does anyone know why this happens?
I have included the database with this post, if this will help anyone (only about 8 Kb).......Thanks
Microsoft Access Database Limitation
Hi There
I am using Visual Basic 6.0 and Microsoft Access 2003 to develop systems. My problem is that the access database file has a maximum capacity of 2Gig (Minus database objects). My clients are complaining because of this problem. I'm in need of an solution. If anyone has information regarding this problem, even if it means moving from access DBMS, please feel free to provide me with this information. Thanx in advance.
HELP - Microsoft Access Database Size
ITtoolbox Portal for Visual Basic - http://visualbasic.ittoolbox.com/
I currently have a number of Access97 databases being used in adepartment which are to say the least becoming big and wobbly.
The database operations stop when the size reaches 1 Gig, (Accessreports database has reached maximum size) is there anyway of stoppingthis, and letting access over run this size limit?
The data is stripped off regularly, as some of the tables contain 2million + records, but unfortunately i have inheirited the problems of aprevious database killer (Sorry i mean programmer).
We are currently in the process of migrating to SQL but because of costsetc. this isnt going to happen quickly, so in the meantime I need helpquickly.
Regards
Steve Tempest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Query Microsoft Access DataBase
hi, all
i need help to create a simple and faster query because the data more thn 1
million record, and i must re-check each record cause they need to encode
first before i can use them.
now, for example we have a database that contain 3 field :
MainNumber as AutoNumber
MainDelete as number
CustName as string
Field MainDelete is contains a number that not use anymore for further, nd
that number is taken from field MainNumber.
MainNumber MainDelete Custname
1 0 Alex
2 0 Cynthia
3 2 Christpher
4 0 Fransisca
.... .... ....
Now, i need a query that can grab all data, where the mainnumber is not n
Main Delete, so only 1, 3 and 4.
The data 2, is not include in query cause he already exist on Maindelete
is That Possible to create a query like it ????
Please Help Me.
Thanks Before,
Hok Sun
Problem With Accessing A Microsoft Access Database Is VB 6.0
Hello, I'm sorry for asking such a dumb question as this since I'm sure u guys are all professional programmers, but I'm a newbie in VB .
What I've been trying to do is make a list of my books in Access with the following record subjects: Book Title, Issue Title, Publisher, ISBN number, Volume Number and Author.
In my VB project, I made those 6 text fields, so that later on I can add, delete, modify or do whatever I need to the list of books. Then I cliccked the "Data" icon in the Toolbox to add the data thingy on my form.
This is the part where I got stuck: after changing the properties of the Data object (like changing the path to the DatabaseName to C:whatevermangalist.mdb), I tried to run the program so far, but it tells me "Unrecognized Database Format"
How can I fix the problem? I was thinking that it might have to do with a problem in the Database itself?....Any suggestions?
Thnx!
Deleting Records From A Database (Microsoft Access)
Hi ive created a program to store movie names and their categories. Ive used a recordset to connect to the database from vb6 but i am having trouble deleting a record from the database from vb6.
If there is any other information you wish to know then please ask but if anyone knows an effective method to delete records from a databse or knows a website that would be of any help please post it.
Thanks
Load A Microsoft Access Database Into A Treeview
Hi all,
I'm a little stuck with this problem of how to load a database(I'm working with a simple database in Access that has the infgrmation of names and addresses from an address book) into a treeview control. I'm using ADO in VB6 as i prefer this over DAO. What i'm trying to acheive is having a treeview control on a form that may show the persons last name, and then by clicking on the item can reveal more information?
Thanks in advance
Jason
Microsoft Access 2000 Database Crash
Hi gurus,
OS:Windows 2000 SP 4.0
D/b:Office 2000
I have a Access db which was working fine for 5 yrs on a standalone m/c
Now recently, we've upgraded to work on network.
Now, this d/b is operated by 3 persons.
Now the problem is, the database is getting corrupted every now & often.
But, Repairing the d/b would solve the problem. But for that all the three users have to close their application. One of the user will repair it. and then others start the application.
But this is happening very often. Even when 2 users are not operating, but their applications are open also, the third computer makes the d/b corrupt.
The client wants it on Access backend. This is my problem.
How can I solve this.
What's the solution?
Please help me out.
With Regards,
Shivakumar G.M.
Installing Database Programs On Machines Without Microsoft Access
I have a program in VB 6 that uses an access database.
When using Visual studio installer, the file msacc8.olb generates a message that "neither a merge module or dependency info could be found for msacc8.olb"
The program just uses the database and I hope to be able to install it on machines that do not have Microsoft Access.
The User will not have to work with the database as code handles all the connections.
What I'm wondering is, if there are other files which VB didn't add to the project that I would need to create a merge module for to get the program to work correctly in such a case.
Obviously, I have Access so it's going to work fine for me. I'd prefer not to have to uninstall it to find out.
I'm a newbie and self taught so really technical stuff will go right over my head.
TIA for any suggestions
Tim Garrison
How To Use EVB Code To Download Microsoft Access Database To Pocket PC ?
Hi,
I have a Microsoft Access database and I use eVB to develop my application. My problem is how to download my database to Pocket PC ?
There are several sites talking about functionality of Microsoft Active Sync ("Import Database Tables") which I found not so friendly.
I am trying to use vb function which is DestoptoDevice function but it cannot be use in Pocket Pc because the vb function that I use is not in Pocket PC environment.
Even I use SHELL in evb to call the vb exe file, it still not work !!!
So I need someone who have experience it to suggest to me...which I want to use evb coding / function to download my Microsoft Access database to my Pocket PC (.cdb) database.
Meanwhile I can't find any solution. ..so I hope someone got an idea for it
Thanks you
Justina
Error In Pulling Up Microsoft Access Database With A Startup Form
I've got frmStartup that loads a hidden frmLogOutMonitor that closes out the original frmStartup form.
I have this because in other databases I may have frmStartup load other forms.
In the frmLogOutMonitor - Form_Open code I have the following:
Code:
Private Sub Form_Open(Cancel As Integer)
On Error Goto Err_Form_Open
'turns hourglass on
DoCmd.Hourglass (True)
'closes Startup form
SysCmd acSysCmdSetStatus, "Closing startup form ..."
DoEvents
DoCmd.Close acForm, "frmStartup"
'check properties for all databases
Call Check_Properties
The Check_Properties is a reference to Public Sub Check_Properties in a module and thus I have several of those that are under Form_Open that point to several modules in various areas. Each one of those modules also has error handling...
Keep in mind that frmLogOutMonitor is opened up as hidden - monitoring all kinds of events. It has a timer that uses ADODB to see if a table has a certain value that is checked off as false because if it isn't then it logs everyone out of the database!
If I don't have the proper Error Handling in this database (with another form) and it stops for some serious reason - then I start having issues with running the database. (even when I fix what's causing the error.)
Even if I decompile the database correctly - after all of that... remove the form from the Startup.... then decompile ... do a compression, then a repair...compile and save all modules.... then later put the form in the Startup....frmStartup it still will not run the database at all. It comes up with that Do you want to send this error to Microsoft?
So I know its technically corrupted. To overcome all this I create a new database and then load everything from the old one - since I can at least open the database if I don't have a form in the Startup. But I can't have this happen everytime I get an error. This is too serious to ignore that this will happen in the database.
When my .NET debugger comes up - it gives the following error:
Unhandled exception at 0x651078f1 in msaccess.exe 0xC0000005: Access violation reading location 0x001b89a7.
Address 651078f1 movzx eax, word ptr [edx+eax]
Do you want to Save changes to msaccess.sln?
An exception 'Unhandled Win32 Exception' has occurred in msaccess.exe
Any ideas how I can solve this?
VBscript To Send Form Values To Microsoft Access Database
Hi,
I have created a html form. Basically i need to have a submit button to perform 2 functions:
1) validate the text fields
2) send the text fields values to Microsoft Access Database
I have already done the coding for validation portion. what i need is how to use vbscript to read the text field values & update to Access table. Can someone help me on this?
Saving Data To Microsoft Access Database ( Couple Of Questions )
Hey Guys
I trying to use Microsoft Access as my Database on my Pocket PC 2002. The only problem is that I don't know how to do my connection. Right now I'm using SQLCE but it giving me problem when I try to Insert data into the Table manually.
This are the code I use to connecto my my SQLCE database table.
Code:Import system.Data
Import system.Data.SQLCE
'Connection to the Database
Dim MyConnection As SqlCeConnection = New SqlCeConnection("Data Source=My DocumentsADP.sdf")
Dim MyDataAdapter As New SqlCeDataAdapter
Dim MyDataSet As New DataSet
'This give the Status of the user depending on the User ID enter in the
'Textbox called txtUserID
Dim Status As String
Try
MyDataAdapter.SelectCommand = New SqlCeCommand
MyDataAdapter.SelectCommand.Connection = MyConnection
Status = MyDataAdapter.Selectcommand.commandText = "Select UserStatus from Users WHERE UserID = '" & txtUserID.Text & "'"
MyConnection.Open()
MyDataAdapter.SelectCommand.ExecuteScalar()
Catch EX As Exception
lblErrorMessage.Text = (ex.Message)
End Try
MyConnection.Close()
1) How could I connect to my access Database??
2) Where would I located or transfer my Database file too on my Pocket PC??? Would I place it in My Document or some where else???
3) What type of file should I convert it to???? I know SQLCe uses .sdf.
4) What I be able to do Query with my Access Database???
5) Would I be able to Insert, Delete, Update, my Access database once it's upload to my pocket pc??
Thanks Guys
Thanks
Sincerely; Oscar Martinez
Edited by - youngOz on 8/5/2004 9:55:28 PM
Modual Problem In Secured Microsoft Access 2000 Database
Hi,
I am having some issues while setting up the user level security in access 2000. I have ran the user level security wizard and it worked great but on all my forms and reports where I use a module object it says "invalid username or password" and I click end and it opens the form. But it works fine on all the other forms and reports that don't use any module objects.
I know that there is a way to write some VB code to connect to the database but everything I saw you must put a DB path and password which is not going to be possible in my case because the database uses the module in many places and the database is going to be deployed to many different computer systems with different paths and passwords thus it is not feasable to change the code at every install. What can I do?
The error:
I open the database and a user name and password box pops up. If I type in an invalid username or password here it tells me it is invalid and this is not the problem. If I log on as an Admin then everything works fine. But when I log on as any other group (Read Only, Full User, etc...) the database opens fine with no errors but as soon as I open a form that uses a module the following error pops up:
run-time error '-2147217843 (80040e4d)':
Not a valid account name or password
With 2 options End or Debug. If I click end the form opens but the module does not run (I know because in one case the module object adds some text to the form).
There is no errors however when I open a form that does not use a module object.
My initialization method in the module (perhaps a problem here?):
Private Sub Class_Initialize()
Set mconn = New ADODB.Connection
Set mrst = New ADODB.Recordset
FixUpRefs
mconn.ConnectionString = CurrentProject.Connection
Debug.Print CurrentProject.Connection
mconn.Open
mrst.LockType = adLockOptimistic
mrst.CursorType = adOpenDynamic
mrst.Open "CustomOptions", mconn, Options:=adCmdTable
Call GetOptions
End Sub
From Semicolon Delimited Text File To Microsoft Access Database Table
Hi,
I have a text file I receive daily with semicolons as delimiters. I was hoping to take certain data from this text file and shoot it into an Access database table (appending to existing data).
My goal is to create a table which historically tracks specific elements in this text file.
Any help or direction appreciated.
Runnning A VB-Access Application On A System Where Microsoft Access Is Not Installed. 2
Hello
I´m Using an VB & Access2002 DB. I´m trying to make the installer for my application where Access97 is installed in target PC´s, or no Access at all.
I´ve solved the problem... I insert the MSOffice XP Install CD into the target PC to update the system (Windows) so that Access 2002 DBs work properly, then i abort the MSOffice XP installation. Some clients ask about the licence of Office XP, and i have to explain that Office XP is not installed in their computers (this sucks, they don´t seem to trust me).
I´ve already checked this topic, it´s helpless
Runnning a VB-Access application on a system where Microsoft Access is not installed.
I´ve already found many MDAC versions but no one seems to work.
Does anybody knows what files does MSOffice XP Install CD uses to update the system before MSOffice XP is installed? I´m clueless, and the file names in the CD are not helping.
Any comment may work...
Edited by - Shandy on 9/8/2003 11:59:02 PM
VB5, Microsoft Excel, Microsoft Access, And Microsoft Word
I am currently using VB5 and I am trying to write a program that takes the data from an Excel file, copy and paste the desired data into a worksheet in the same workbook. I would then take that data, sort it, and then extract one type of data into one column and another type in the next column. With the data extract the code will tell Access to create a blank database and to import the data from the Excel file into a new table. After the importing the code will then match data from the Access file to data in a Word file. If there is a link, the code will then parse the data into the form.
Is there a way to do all of this?
RUN-TIME ERROR:[Microsoft][ODBC Microsoft Access Driver]cannot Update
Error message; Cannot Update1 Database or object is read-only?
please help me? i'm having a prolem updating my tblSubject in my database. here's my code:
Dim Record As New ADODB.Recordset
Private Sub Form_Load()
SQL = "Select a.*, b.Subj_Desc, b.Subj_Units From tblSubj_Intrc a, tblSubjects b " _
& "Where a.Subj_Code = b.Subj_Code"
Record.Open SQL, MyConn, adOpenStatic, adLockOptimistic
getFields
SetLock (True)
Set_Buttons
End Sub
Sub getFields()
If Record.EOF Or Record.BOF Then
MsgBox "Wala nay Recordord"
Exit Sub
End If
txtDesc = Record!Subj_Desc
txtSubCode = Record!Subj_Code
txtUnits = Record!Subj_Units
txtNum = Record!Num_Stud
End Sub
Sub ClearFields()
txtDesc = ""
txtSubCode = ""
txtUnits = ""
txtNum = ""
End Sub
Sub SetButtons()
cmdAdd.Enabled = False
cmdEdit.Enabled = False
cmdDel.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
End Sub
Sub Set_Buttons()
cmdAdd.Enabled = True
cmdEdit.Enabled = True
cmdDel.Enabled = True
cmdSave.Enabled = False
cmdCancel.Enabled = False
End Sub
Sub SetLock(Stat As Boolean)
txtDesc.Locked = Stat
txtSubCode.Locked = Stat
txtUnits.Locked = Stat
txtNum.Locked = Stat
End Sub
Private Sub cmdLast_Click()
If Record.RecordCount > 0 Then
Record.MoveLast
getFields
End If
End Sub
Private Sub cmdNext_Click()
If Record.RecordCount > 0 Then
Record.MoveNext
getFields
End If
End Sub
Private Sub cmdPrev_Click()
If Record.RecordCount > 0 Then
Record.MovePrevious
getFields
End If
End Sub
Private Sub cmdFirst_Click()
If Record.RecordCount > 0 Then
Record.MoveFirst
getFields
End If
End Sub
Private Sub cmdAdd_Click()
ClearFields
SetButtons
SetLock (False)
txtDesc.SetFocus
EditMode = False
End Sub
Private Sub cmdSave_Click()
If Not EditMode Then
Record.AddNew
Record!Subj_Desc = txtDesc
Record!Subj_Code = txtSubCode
Record!Subj_Units = txtUnits
Record!Num_Stud = txtNum
Record.Update
SetLock True
Set_Buttons
Else
Record!Subj_Desc = txtDesc
Record!Subj_Code = txtSubCode
Record!Subj_Units = txtUnits
Record!Num_Stud = txtNum
Record.Update
SetLock True
Set_Buttons
End If
End Sub
Tnx1
[Microsoft][ODBC Microsoft Access Driver] Could Not Delete From Specified Tables.
I've searched hi & lo and found alot of titles that read the same, but nothing that really addresses this situation.
The code below runs fine, until iCnt = 5, because the table is still held open by the previous Execute.
If I put a break on that line and run to that point, step that line, then continue the run, no problem. Works great.
But if I run it continuous from a cmdButton, I get the error.
I've tried transactions, different providers, more than default timeouts on command and connection, do.cmd runsql,....
This is one of those where I said, "sure, that's easy", about a month ago.
Dim ..., Cnxn As New ADODB.Connection
sPath = CurrentProject.FullName
Cnxn.CursorLocation = adUseClient
Cnxn.Mode = adModeReadWrite
Cnxn.Open "Provider=MSDASQL.1;DBQ=" & sPath & ";Driver={Microsoft Access Driver (*.mdb)}"
iCnt = 0
DoCmd.Close acForm, "Personnel List", acSaveNo
iCnt = iCnt + 1
Cnxn.Execute "DELETE ALPHA.* FROM ALPHA;", , adExecuteNoRecords
iCnt = iCnt + 1
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "ALPHA", "file.xls", True
iCnt = iCnt + 1
Cnxn.Execute "DELETE [Civilian Backup].* FROM [Civilian Backup];", , adExecuteNoRecords
iCnt = iCnt + 1
Cnxn.Execute "INSERT INTO [Civilian Backup] SELECT Civilian.* FROM Civilian;"
iCnt = iCnt + 1
Cnxn.Execute "DELETE Civilian.* FROM Civilian;", , adExecuteNoRecords
iCnt = iCnt + 1
Cnxn.Execute "INSERT INTO Civilian ( [Full Name], [Rank], [Office Symbol], [Unit Desc] ) SELECT ALPHA.[Full Name], [PP] & '-' & [GR] AS Rank, ALPHA.[Office Symbol], ALPHA.[Unit Desc] FROM ALPHA;", , adExecuteNoRecords
iCnt = iCnt + 1
Cnxn.Execute "DELETE ALPHA.* FROM ALPHA;", , adExecuteNoRecords
What's the catch?
Thanks!!!
[Microsoft][ODBC Microsoft Access Driver] Not Enough Space On Temporar
Hi all,
----------------------------------
Set connData = New ADODB.Connection
connData.ConnectionString = Data_Master
connData.Open
connData.BeginTrans
connData.Execute "Delete * from feed_msg where date < date()"
connData.CommitTrans
------------------------------
at conndata.execute following error is occuring,please update, can anyone please help me in this
''''''
-2147024882
[Microsoft][ODBC Microsoft Access Driver] Not enough space on temporary disk.
regards
John Philip
*** Even the Best, did the Bad and Made the Best ***
John Philip
Exporting Data From One MS Access Database To Another MS Access Database In Visual Basic
hello friends,
i want to transfer the data from one Access database to another Access database using visual basic.
The first Access Database name is Data1
Table Name is tbldata1
fields - ID -- Number
venueID -- Number
Date --- Date/Time
RNo --- Number
SRNo --- Number
HNo --- Number
i want to transfer this data into the second Access Database -- Data2
with table name same & fields also the same
pls can anyone help me out with this problem
Regards
Girish
[Microsoft][ODBC Microsoft Access Driver] Attribute Cannot Be Set Now
I have got an option to save a file in my program. This is the code to it:
Code:
Public Function saveblast()
Select Case flagsave
Case 1:
' Save only Blast Desing & these related information
On Error GoTo errortrap:
contoRCB.BeginTrans
Call addtodetail
Call addtodesign
Call addtoperformance
Call makestr
contoRCB.CommitTrans
Case 2:
' Save only Blast Desing & these related information
On Error GoTo errortrap:
contoRCB.BeginTrans
Call addtodetail
Call addtodesign
Call addtoperformance
Call makestr
flagfound = False
Call addtochrgsht
contoRCB.CommitTrans
Case 3:'........................
Now the error trap has the following code:
Code:
errortrap:
MsgBox Err.Description, vbInformation
contoRCB.RollbackTrans
Now when I disable the error trap it simply exits the function without performing the required operation & does not give any error message.
But with error trap enabled, I manage to get the above mentioned error:
[Microsoft][ODBC Microsoft Access Driver] Attribute cannot be set now
could somebody please help me
Thanks in advance
Open Access Form From A Password Protected Access Database Through VB
Iam using a password protected Access database. I can open the database with out any problem. There is a startup Access form associated with this database. I would like to open this form with out any prompt to the user for the password. When the program is run, the database opens twice. The first instance with the login screen prompting the user for the password. The second instance opens as desired. How to overcome this problem with the program opening the form only once.
Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Const VK_CAPITAL = &H14
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Const KEYEVENTF_KEYUP = &H2
Private Sub SafeSendkeys(ByVal keys As String, Optional bWait As Variant)
Dim keysBefore(0 To 255) As Byte
Dim keysAfter(0 To 255) As Byte
Call GetKeyboardState(keysBefore(0))
If IsMissing(bWait) Then
Call SendKeys(keys, False)
Else
Call SendKeys(keys, CBool(bWait))
End If
Call GetKeyboardState(keysAfter(0))
If keysBefore(VK_NUMLOCK) <> keysAfter(VK_NUMLOCK) Then
Call keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
End If
If keysBefore(VK_CAPITAL) <> keysAfter(VK_CAPITAL) Then
Call keybd_event(VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
End If
If keysBefore(VK_SCROLL) <> keysAfter(VK_SCROLL) Then
Call keybd_event(VK_SCROLL, &H45, KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(VK_SCROLL, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
End If
End Sub
'Under a click event I have:
'************************
UserApps(AppAP).appRunPath = "C: estdb1.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)
Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)
'************************
What is wrong in my code?
Thanks in advance.
Rama
How To Open An Access Form From A Password Protected Access Database?
I have a password protected access database. I can open this database. Though the startup form (Access form) comes up, the database opens twice. One instance with the login screen for the password (since the database is password protected) and the other opens properly with the form. Can any one help in opening without the first instance occuring?
Code:
UserApps(AppAP).appRunPath = "c: estdb.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
(AppAP).appRunPath, "password")
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)
Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)
Thanks in advance,
Rama
Shared Access To An Access 2000 Database In A Network Directory
Hi!
My application (a VB executable) uses a Microsoft Access database to store various information entered by the user. The application and the database are located on the network so many users can access it simultaneously. Just recently, I implemented persistent connections so the database connection remains open for the entire life of the application (which speeds things up considerably compared to connecting every time something needs to be done). Since then, only one user seems to be able to connect at any single time. As far as I know, Access allows about 20-30 simultaneous user connections without a problem (and can do much more), so why does it lock the database exclusively? The application is loaded into the memory of every user's computer, so each user should use only their own connection object.
Here's the code I use to connect:
==================
Set m_DbConnection = New ADODB.Connection
With m_DbConnection
sDSN = "Provider=Microsoft.Jet.OLEDB.4.0;"
sDSN = sDSN & "Data Source=" & sDb & ";"
sDSN = sDSN & "Persist Security Info=True"
.ConnectionString = sDSN
.CommandTimeout = 8 'wait 8 secs before exiting commands
.ConnectionTimeout = 15
.CursorLocation = adUseClient
.IsolationLevel = 4096
.Mode = adModeShareDenyNone Or adModeReadWrite
.Open
End With
PROC_Exit:
Exit Function
PROC_Error:
If Err.Number = -2147467259 Then 'Cannot open database (either doesn't exist or locked)
Dim vErr As ADODB.Error
If Not (m_DbConnection Is Nothing) Then
If m_DbConnection.Errors.Count > 0 Then
For Each vErr In m_DbConnection.Errors
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, vErr.Number, vErr.Description & " (native error: " & vErr.NativeError & ")", vErr.Source, "basDb::PrepareConnection"
Next vErr
Else
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
Else
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
Else
DisplayDetailedError Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
Resume PROC_Exit
==============
If another user already connected to the db, I get this error:
Error #-2147467259: Unable to use ''; file is already in use. (native error: -67044352, minor error code: -1024, major error code: -1024, Jet IDA Number (DAO Error): 3045) [source Microsoft JET Database Engine, procedure basDb::PrepareConnection]
(the first error is an ADO error, the native error is what the data provider returns, and other things are just what I got after doing a few searches on MSDN).
I first thought that the problem is about the Mode property setting of the connection object, but MSDN describes adModeShareDenyNone constant as the less restrictive, full database sharing mode, and combining it with adModeReadWrite seems the most logical solution to allow others to read/write data. I even tried to remove it (leaving only adModeReadWrite), but the same thing took place.
I tried to change the CursorLocation property to adUseServer, but it had no effect.
I tried updating the version of MDAC to 2.6, but to no avail.
Have any of you had the same problem or knows the solution? I will appreciate any help I can get!
Thanks a lot in advance!
Stanislav
Simultaneous MS Access Database Access Problem Using VB6 Program.
am using MS Access database by a vb6 program for multiuser environment.
In the program I have written code for autogenerating employee_id which is primary key in the table.
When entering records simultaneously from two or more workstation,
It gives a problem
Run time error
The changes you requested to the table were not successful because they would create duplicate values in the primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
How to resolve it.
Is there any way to restrict the database from accessing when record appending goes on by other workstation.
How Do I Access A Linked Table On A Passworded Access Database?
i have 2 passworded databases, one named db1.mdb and db2.mdb, db1.mdb is the main one and has linked tables from db2.mdb in it. If i open db1.mdb it asks for a password so i put the password 'test' in and it opens ok. I can access tables within db1.mdb but if i click on a linked table contained within db2.mdb it says not a valid password. The same thing happend when i try to access it the same way with code. How do i access linked tables with code? im using now the code below and it says invalis password because of the above reason.
dim db as database
dim rs as recordset
set db=opendatabase("c:db1.mdb",False,False,"MS Access;pwd=test")
set rs=db.openrecordset("table1")
'table1' is a linked table and contained in db2.mdb and it wont let me access it. Anyone got any ideas?
Any Way To Convert An Access XP Database To Access 97 Format?
Can this be done WITHOUT using Office XP? A buddy here at work has some an access DB he worked on at home (using office XP), however he forgot to convert it to 97 format (since we only have office97 at work). Is there a tool outthere (besides access XP itself) that will convert access databases from XP format to 97?
Copying Access Table To Another Access Database Using ADO.
Dear All
Can anyone please guide me how do I copy MS Access Table from one Database to another (both MS Access .mdb files) using ADO/SQL in Visual Basic.
Actually I wanted make simple Database Table Import/Export utility in Visual Basic.
I will be very thankful for your help.
Farhan
Access Password Protected Access Database
heyy all..just a small question..
i use DAO to manipulate my access database. When i protect my database with a password, i cannot access it with my code. I get an error message saying "Invalid password" i think or something like that. Where should i include the password in my code?
The code i use to access my database is in a module, and this is it:
VB Code:
Public dbServer As DatabasePublic rsFileLog As Recordset public sub connect()Dim qry As Stringqry = "Select * from FileLog" '<--- Table name is FileLogSet dbServer = OpenDatabase(App.Path & "Log.mdb") Set rsFileLog = dbServer.OpenRecordset(qry, dbOpenDynaset)
thanxx in advance
Lock Records In Access Database Access :D
I'm working in an accounting software (if I'm translating OK from spanish )
Situation:
Access 2000 database.
One user is editing or deleting a record in one table.
Another user want to access the same record. I must lock the record for editing or dleting, but not for consulting, but in this case I have to notify the consultant this record is being editing by other user.
I don't know how to do this, thanks.
Access Database : Combining 2 Access Databases
hello friends,
I and one of my friend have been assigned a work
of filling database entries in Ms access.
The entries would consists fields such as name ,address and telephone number.
But the problem is that there are 1200 entries !!! So I and my friend have decided to split the work so i will fill 600 entries and he would fill 600 entries.But we have to submit it as one assignment i.e the one database. and the entry no. should come in order i.e from id no. 1 to id no 1200.
how do we combine 2 databases with minimum fuss ?
waiting for reply
Prasad
U can mail me at prasadkowli@yahoo.com
|