Convert Access Database To Works Database Via Code?
Does anyone know of a way to convert an access 2000 database to a msworks database via VB6 code? ANY suggestions are welcome. TIA.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Access Database Only Works On 1 Computer.
I followed the instructions at http://support.microsoft.com/default.aspx?scid=kb;en-us;278379 to stop the mouse from scrolling records.. But now the database only works on the computer that i compiled the dll on. Every other computer it gets errors. Any suggestions? I did get it to work on another computer, but i had to install visual studio, and compile the dll on that computer.
RTF And Access Database: Works On One Computer, Doesn't On Another!
Briefly: a functioning app, when deployed to other computers, works fine EXCEPT that the rtf control doesn't retrieve any data from the underlying database.
My VB6 program saves the contents of an RTF box into a memo field, in an Access database using ado.
A week ago, I packaged the app and installed it on another computer. The application runs fine, it prompts me for my userid and password (these are both text boxes, NOT rtf), it launches okay, the form and all its contents are good except the rtf box: it is empty.
So everything seems to work fine except the rtf control, which is not retrieving data from access. So I am guessing there is some file which I must install on this second computer, so it can use the rtf control? Something the Packaging Wizard missed maybe?
This second computer runs several other non-RTF apps which I have designed; it does NOT have VB6 installed on it; it's oeprating systems is windows 2000.
Thanks for your help!
Read/Write Access VERSION 2 Database Using ADO Only Works First Time?!
** Just realised that the database is being used by Access v2, not Access 97 as I originally posted!! **
I've written some code that reads and writes to an Access v2 database.
(The code is VBA, in an Excel spreadsheet, I wasn't sure whether to post this here or in the VBA area of the forum)
I tested it on my pc and it works fine. I tested the database by looking at it in Access 2002 (I don't have Access v2).
My customer (who uses the database through Access v2), has encountered this problem:
(Access v2 database is already open (by them or someone else) )
Run the macro and it works fine (reads and writes data to the database).
Run it again and it fails to open the database!
It won't work again unless you close the database!
It works fine if the database is never opened.
I can't reproduce this error on my pc but I've seen it happen on theirs.
My guess is that this is something to do wit the different locking mechanisms employed by Jet 4 (Access 2000+) and Access v2 but I'm not sure. I'm opening the database using the Jet 4 data provider.
I've suggested converting the database to Access 2000 but it seems there may be problems with that...
I tried setting the connection string to use the jet 3.51 provider but that fails as it's not on the system.
(That may not be appropriate as I now know it's an Access v2 database, not Access 97 as I previously thought)
Any help would be greatly appreciated as I'm now completely stumped!
Here's the code:
Code:
Private Function updateStock(ByVal ProjectNumber As Long) As Boolean
Dim db As clsDB_Buying
Dim rs As ADODB.Recordset
Dim sql2 As String
Dim stockField As Integer
Dim stockFieldName As String
Dim stockUnits As Single
Dim stockUnitsInBuying As Single
Dim stockUnitsTotalInBuying As Single
Dim action As Byte
Dim actionMsg As String
On Error GoTo errHandler
' Create a db instance for Buying
Set db = New clsDB_Buying
If db.valid = False Then Exit Function
' Read/write entries in the database (code removed for brevity...)
Set rs = Nothing
Set db = Nothing
updateStock = True
Exit Function
errHandler:
errMsg "Error updating stock items in Buying!" & vbCr & "(" & Err.Description & ")"
End Function
Here's the class that handles the database:
Code:
Option Explicit
Public valid As Boolean
Public cnn As ADODB.Connection
Private Sub Class_Initialize()
openDB
End Sub
Private Sub Class_Terminate()
closeDB
End Sub
Private Sub openDB()
On Error GoTo errHandler
Const DBprovider = "Microsoft.Jet.OLEDB.4.0"
Dim databaseFile As String
databaseFile = Worksheets("HMS").Cells(38, 2).Value & "Buying.mdb"
Set cnn = New ADODB.Connection
errTryAgain:
With cnn
.CursorLocation = adUseClient
.Provider = DBprovider
.Mode = adModeShareDenyNone
.Open "Data Source=" & databaseFile & ";Persist Security Info=False"
End With
valid = True
Exit Sub
errHandler:
valid = False
Select Case Err.Number
Case 430
' Class does not support Automation or does not support expected interface
' Problem with ADO?
errMsg "Problem with Database components" & vbCr & "(Check installation of ADO)"
Case -2147467259
' Can't open the database
''errMsg "Can't open the database!" & vbCr & databaseFile
If MsgBox("Can't open Buying!" & vbCr & "(" & databaseFile & ")" & vbCr & "Try again?", vbExclamation + vbYesNo) = vbYes Then
Resume errTryAgain
End If
Case Else
' Unknown error
errMsg "Unexpected error creating DB Connections!" & vbCr & errNoDesc
End Select
End Sub
Private Sub closeDB()
If Not cnn Is Nothing Then
If cnn.State = adStateOpen Then cnn.Close
Set cnn = Nothing
End If
End Sub
Mac
Edited by - Mac2309 on 2/17/2008 3:58:01 AM
Convert An Access Database To A Standalone Vb Application
I am searching for the easiest way that i can turn an exsisting ms access database into a stand alone application. Emphasis on the word easiest, I am still a novice of vb.
I looked into ado and all the other initialed things, and appeared to me as being linked to the db, not it's own. I want the user defined access layout and design of the db, forms, reports, fliped into a .exe.
Convert A Remote Ms Access Database To A Txt File
Hi
I am looking to develop a visual basic application that connects to a ms access database that is hosted on a server. The application then needs to create a txt file on the server and then select certain records from the database and write them to the txt file.
Would anyone have any knowledge or guidance on how this could be achieved.
Thanks
Jonathan
Convert String To Date Using Vb With Access As Database
I want to convert a string variable called, strfl to a date using vb. I am using the codes shown below. The database is msaccess. The following code throws an error when the code, 'rstDelete.MoveFirst' is executed.
Error message : "Either BOF or EOF is true........".
But there is a value for hdate in the table called holiday which is equal to "20-09-05".
So, the problem has to be with conversion of string to date which is in the part of the code, "hdate = #" & (strfl) & "#"
Can anyone please help me by showing the proper string to date conversion that works with ms access?
Code:
strfl = "20-09-05"
If strfl <> "" Then
rstDelete.Open "Select * from holiday where hdate = #" & (strfl) & "#", db, adOpenKeyset, adLockOptimistic
rstDelete.MoveFirst
While Not rstDelete.EOF
rstDelete.Delete
Wend
rstDelete.Close
HOW DO I CONVERT A EXCEL FILE TO ACCESS DATABASE?
Hello Friends
Can anybody please tell me that
1) HOW CAN I WRITE A CODE THAT MAY CONVERT A EXCEL FILE TO ACCESS DATABASE?
2) HOW MAY I USE FILE-LISTBOX THAT SHOULD DISPLAY THE FILES ONLY OF .XLS EXTENSION?
Please send me the same as soon as possible.It's very urgent for me.
Hope u will help me.....
Convert An Access Database From The Access2000 Format To The Access2002
I have a VB.Net application that needs to convert an Access Database from the Access2000 format to the Access2002 format. Is there a way to programmatically do this in Visual Studio 2005. I can get the following code to work in Visual Studio 2003 but when I try to do it in Visual Studio 2005, after adding the Access 11.0 reference to the project the Access object is still undefined.
' Convert existing DB to Access 2002 format
If File.Exists(DBDirectory & "dealinfo.mdb") Then
Dim acc as Access.Application
app = New Access.Application
app.ConvertAccessProject(DBDirectory & "dealinfo.mdb", _
DBDirectory & "
ewdeal.mdb", _
acFileFormatAccess2002)
File.Delete(DBDirectory & "dealinfo.mdb")
File.Move(DBDirectory & "
ewdeal.mdb", DBDirectory & "dealinfo.mdb")
End if
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?
Can You Convert A Mircrosoft Access Front End Database Into Visual Basic?
The root problem is Access database speed over the network.
Also, may have something to do with my Access DB design (i.e
subforms, many records, etc.) vs. the network.
However, I tried splitting the database into front and back ends
in hopes for some improvement, but no dice. We do have an
application we received from another group that uses Visual
Basic 6 on the front end and an Access backend. It seems to
work pretty smooth although it is pretty simple in
design/content.
Is there an easy way to convert the front end of an Access
database into Visual Basic 6 or even VB.Net?
Error: Unregconize Database Format After Convert Database
previously i design my database using Data Manager. after that i wish to set password to the database using Access 2000, but the 'Set Database Password' is disabled. So i convert the database to current database, then i can set the password.
BUT, i come back to my program, all Data Control cannot be refresh. an error says "Unregconize database format....". After sometime of exploring, i change the Connect property from Access to Access 2000, now it can run properly.
BUT, after i compile the program, make a setup package, and reinstall to other PCs, some PC can work but some PC give Error 3170 - Could not find installable ISAM.
anyone can advise?
how can i remain the Data Control's Connect property to Access, so that other PCs can work properly? is it i must convert the database using Access below 2000?
please advise. thank you.
Convert A SQL Server Database To A Pocket PC Database
Is it possible to convert a SQL Server database (not all tables of it) directly to a Pocket PC database, using Visual Basic 6?
If not, wat are the alternatives, for example using ODBC, Winsock or some sort of ActiveSync API?
How To Convert Old Database To New System With New Database?
Hi, all.
I need your opinions for my project that converting dos-based old system to new system.
I got new project for one factory.
They have DOS based application using VisionPoint and SBT with FoxPro 2.5 database.
When I checked the database files... bunch of .DBF, .CDX, .FPT, .FKY..... files..
I think they used software tool package to develop the application without considering database schema design..
I also couldn't find database file containing whole tables .. I found only table file..
I never used the VisionPoint and SBT as well as FoxPro.
I tried to import the database from SQL server.. but, SQL server ask DSN fileformat. (What is DSN file?)
It didn't work..
I want to use Access and Visual basic for this project. (later on I may move to Sql server, but not now)
I don't know how to convert the old system's database to Access...
I don't know which .DBF table are right tables containing the actual business data or which tables are system house keeping tables..
Please give me any comment if you have any idea for this, if you have done this kind of project, or if you ever converted old system to new system..
If I get exact answer for this situation, it's best.. ( i don't think..i can..)
THis is first time for me to convert old system to new system... (I've done only new systems)
Please provide any idea for this ..
Thank you...
I'm Looking For Code Example To Access Database
Hi,
I'm beginner in VB.
I'm looking for code example which does the following thing :
- Open a Word Document template where fields & structure are already defined.
- Connect to a database (AS400 for example)
- Pull some data from a file whose name is passing by parameters in the pgm
- Save & Close
example : c:pgmpgm.exe parm1 parm2
Did someone make approximately the same ?
Thank you in advance ...
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
Problem With VB Code In Database (access)
Hey, my friend is having problem with a form in a database. Everytime he clicks on a navigation button, or a button to open a form. An error occurs...
Looking into the VB Code, the following is highlighted yellow:
http://img332.imageshack.us/img332/7300/sefwefxg2.jpg
Code:
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
DoCmd.GoToRecord , , acLast
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click
End Sub
Create Access Database In Code Using ADO
I know how to open a database through code but can't figure out how to create an Access database in code ONLY using ADO. DAO's no problem but not ADO. Any takers?
Thanks (in advance)
How To Create Access Database From Code Using ADO Not DAO
Hi Guys,
I'm making a small application in Access VBA. Since ADO is the default reference in Access I was wondering if it's possible to create access database using ADO.
For DAO it looks like this;
'Add reference to DAO
Dim ws As Workspace
Dim db As Database
Set ws = DBEngine.Workspaces(0)
'substitute Password with the desired password
Set db = ws.CreateDatabase("test.mdb", dbLangGeneral & ";pwd=Password")
Compact Access Database From VB.NET Code
Hi all,
I just want to ask if there is a way of compacting database from VB.NET code I have seen examples in VB6 but they all refer to JRO.JetEngine what do I have to import in VB.NET to make this work or does sombody have an example of doing this in VB.NET
Thanks
--------------------------------------------------------------------------------
<Signature>
That boy is our last hope.......................................
No there is another !
</Signature>
Open A Access 2000 Database From Vb6 Code
hi all
in a small vb6 form there is a button, onclick of that button i need to open a access2000 database
what i want to do is close vb forms and open microsoft access2000 with my database opened
i know the path of this specific database and a password has set for the database too. so i need to pass the password as a parameter when i'm calling for the database
can anybody tell me how to write this small code part
thank you very much
Code To List Tables From An Access Database
Does anybody know what kind of code is required to extract the individual Table names and Query Names from inside a Microsoft Access database (.mdb extension). I have objects and code to deliver a user to the place where he/she can select an Access database file but if there are several tables and/or queries inside that database I don't know how to display them in a filelistbox or straight Listbox. Any ideas?
Checking If An Access Database Is Already Open Thru Vb Code
when i try to do a mail merge and open the datasource I am getting lock errors reason being because the database is already open. Now I did not write this code I just inherit, but I noticed that this code never closes the database. At first this code was going after a linked table in another database then I move the database to the same access table that I am already in so if I do that there is no need to open the datasource but how do I change the following line not to open the datasource since it is already open all I need to do is execute the query.
appword.ActiveDocument.MailMerge.OpenDataSource mydb.name, , False, True, , , , , , , , , "SELECT * FROM [Document_query1]"
Function Back_to_word(trigger As String)
Dim LOAN_RECORD, answer, dlg, dummy, name1, test, table_name2, test1, objectstate, name, user As String
Dim abutton, rnd_number As Single
Dim random_number As Integer
Dim fselected As Variant
Dim appword As word.Application
Dim connect1, TABLE_NAME As String
Dim closed As Boolean
Dim mydb As Database
Dim myrecordset As Recordset
Dim timer1 As Long
Dim Leave As String
'On Error GoTo out
DoCmd.SetWarnings False
Set appword = GetObject(, "word.Application")
Set mydb = CurrentDb
Set myrecordset = mydb.OpenRecordset("DOCUMENT_QUERY1")
name1 = myrecordset.name
AppActivate "Microsoft Word"
appword.ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
appword.ActiveDocument.MailMerge.OpenDataSource mydb.name, , False, True, , , , , , , , , "SELECT * FROM [Document_query1]"
With appword.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
On Error Resume Next
.Execute Pause:=True
End With
If trigger = True Then GoTo out
DoCmd.Close acQuery, "Document_query1", acSaveYes
appword.Quit (wdDoNotSaveChanges)
out:
Rebuilding/Compacting Access Database In Code
Hallo
I want to activate the rebuilding and compacting of my database after a certain period elapsed. The problem starts with the Compact-method. I have to specify a new db name (the compacted one), therefore I have to delete the old one, rename the new one so that it has the same name as the old db. For some reason the DELETE (of file) and RENAME methods are not accepted at Design-time. Is there some other way of doing this?
I need help!
Thank you
Locating Records In Access Database Thru VB Code
I am using VB6.0. I have connected my MS Access 2000 database using ADODC. How can I search and display all records matching a criterion. For example, to display all records with surname beginning with 'MO' in the SurNamefield of the database.
Someone to help please.
Sam
Repair/Compact Access Database From VB.NET-code
A: Can an app use MS Access 2003 database if there IS NOT access 2003 installed to the computer?
B: Is there a way to compact/repair an access 2003 database via vb.net code? (found some results for this, looking some other way than process.start...)
Thx in advance,
Tutuster
How To Create SystemDSN Through VB Code For Access Database
I've started my career as a VB programmer. I've created an Access database with some password set to it. Now I want to create a SystemDSN for that database ,that can be generated through VB code. This is the code that I've written for the same resulting some error.
Option Explicit
Private Declare Function AccessConfigDatasource Lib "ODBCJT32.dll" (ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long
Private Const ODBC_ADD_SYS_DSN = 4
Public Function CreateAccessDSN(DSNName As String, DatabaseFullPath As String) As Boolean
Dim sAttributes As String
If Dir(DatabaseFullPath) = "" Then Exit Function
sAttributes = "DSN=" & DSNName & Chr(0)
sAttributes = sAttributes & "DBQ=" & DatabaseFullPath & Chr(0)
CreateAccessDSN = CreateDSN("Microsoft Access Driver(*.mdb)", sAttributes)
End Function
Public Function CreateDSN(Driver As String, Attributes As String) As Boolean
CreateDSN = AccessConfigDatasource(0&, ODBC_ADD_SYS_DSN, Driver, Attributes)
End Function
Binding Controls To Access Database By Code- Using Ado
I have witnessed the slow-down in performance,
particularly when one has a form with many Adodc controls (say, for example,
when one needs to make selections from DataCombos). In my case, the form has
many textboxes and about seven Datacombo controls. I am led to believe the
approach I used by binding the controls to related Adodc controls on the
form has a performance penalty. So, I am trying to re-write most of what I
have in code (i.e. without using the ado controls supplied in vb6).
I progressed fine, but ran into trouble when
trying to bind the datacombo in code. I insert below my code:
' Code in MainForm
' This is just a demo test-drive program.
private cbo as DataCombo
private depRS as ADODB.recordset 'I created this recordset for the
datacombo, which contains all the department names (about 90) from
' a table
in the database called Dept. There are two tables in the database- Dept and
Employees.
' The database fields are as follows:
' for table named Dept-> ID, DeptName
' for table named Employees-> ID, DeptName, FirstName, LastName
private recordset as ADODB.recordset ' for main employees table
private connection as ADODB.connection
private Sub cmdConnect_Click()
set recordset = new ADODB.recordset
set depRS = new ADODB.recordset
set connection = new ADODB.connection
connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Data
Source=c:windowsdesktopdbtest.mdb"
connection.Open
recordset.Open "Employees", connection, adOpenKeyset
depRS.Open "Dept", connection, adOpenKeyset
' I have attempted to initialise the datacombo with the data from the
database table
for Each cbo In me.dcboDeptName
set cbo.DataSource = recordset
set cbo.RowSource = depRS
cbo.DataField = "DeptName"
cbo.ListField = "DeptName"
cbo.BoundColumn = "DeptName"
next
'Bind the text boxes to the data provider
populateFields
End Sub
private Sub populateFields()
txtFirstName.Text = recordset.Fields("FirstName")
txtLastName.Text = recordset.Fields("LastName")
dcboDeptName(0).Text = recordset.Fields("DeptName") ' I am not sure
about this one
End Sub
private Sub cmdNext_Click()
on error GoTo GoNextError
recordset.MoveNext
If recordset.EOF then recordset.MoveLast
populateFields
Exit Sub
GoNextError:
MsgBox Err.Description
End Sub
private Sub cmdPrev_Click()
on error GoTo GoPrevError
recordset.MovePrevious
If recordset.BOF then recordset.MoveFirst
populateFields
Exit Sub
GoPrevError:
MsgBox Err.Description
End Sub
private Sub Form_Unload(cancel as Integer)
If Not (recordset is nothing) then
recordset.Close
depRS.Close
connection.Close
set recordset = nothing
set connection = nothing
End If
End Sub
Well, my problem is that when I make a department selection from the
datacombo, It is not updating the "DeptName" field in the Employees table.
Also, when I fire the next or previous button the fields on the forms are
displayed accordingly. However, I try to make a department selection and
then press Prev or Next buttons I get the following error: "The change was
canceled during notification; no columns are changed"
Well, that's it. I'd appreciate any suggestions or examples or corrections
regarding the use of DataCombo with code.
Sincerely,
Hansel
hansel@solutions2000.net
Split An Access Database Via Code/programatically
I'm looking to split a large quantity of access databases with a single script.
Is there, or does anyone know of a function which will allow me to do this? splitDB ( SRC, DST ) ?
(my previous post wasn't exactly clear when I reread it)
Thanks in advance,
Wes.
Importing A MS Access Table From One Database To Another Via Code
I am using VB 6.0 with an Access 2000 database. I am most familiar with ADO. Is there a way to import or copy a table from an Access database into a different Access database? I need the complete table, data and all. I know how to create a table and copy the data from one recordset to another, but not to import an existing complete table (if possible). Thanks in advance.
Catrina
VB & Access :Is There A Way To Combine Vb Code With Access Database?
Hi, I'm developing an access database program with vb6. I have made my tables and db in MS Office 2003 Access and then written the code and control in vb6 IDE. Whenever I want to use it I compile it and then make a runtime and build an exe file but this exe file needs the database & table along with it. Now, Is there a way to compile and build a standalone exe from my vb program which the database (Access) be included in the one exe file along with program code so the end user wouldn't be able to mess around with the database seperately!? Can anyone help me? I'll be appreciated. Thanks ahead...
Creating An Access Database From Visual Basic Code
hi ,
can anyone help me in creating an access 200 database from the visual basic code.? i got some code from the net which creates database from the VB but when i use the code it is giving me error. iam posting the code in this thread. please go through and give me reply. this is part of my thesis work so please help me out.
thank you.
NOTE: i have visual basic 6.0 and access 2000 on my computer
code that creates database:
Option Explicit
Sub CreateAccessDatabase()
Dim CatDB As ADOX.Catalog
Set CatDB = New ADOX.Catalog
CatDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=myMDB.mdb"
Set CatDB = Nothing
End Sub
Sub CreateTable()
Dim CatDB As ADOX.Catalog
Dim TabDB As ADOX.Table
Set CatDB = New ADOX.Catalog
Set TabDB = New ADOX.Table
'open the database
CatDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=myMDB.mdb"
'create new table object
With TabDB
.Name = "MyTable" 'set name
'add fields and specify datatype
.Columns.Append "First Name", adVarWChar
.Columns.Append "Last Name", adVarWChar
.Columns.Append "Age", adInteger
End With
'add the table to database
CatDB.Tables.Append TabDB
Set CatDB = Nothing
Set TabDB = Nothing
MsgBox "Database and Table created..."
End Sub
Private Sub cmdCreate_Click()
CreateAccessDatabase
CreateTable
End Sub
Compile time Error:
User defined type not defined
and the control goes to this line
Dim CatDB As ADOX.Catalog
Please give me reply on this
Code To Remove User Permissions (MS Access Database)
Hi all,
I have an access database that was copied to a new PC. This database has user permissions and/or groups setup on it. But when trying to access the database now the user is being told that they don't have the necessary permissions to access it. Unfortunately the old PC has been formatted. Does anyone have code that can remove the security feature from the database?
Just a few questions, if anyone knows the answers?
1. What is the extension of the permissions file?
2. Where is it usually stored?
3. The old PC was ghosted, so why wasn't the permissions file also brought across?
Thanks a million for any help,
How Do You Link A Text File To An Access Database Using Code
Hi
I have a comma delimited file that I would like to link into an access table so it opens as a table in access , I need to do this in code though , how is this achieved in VB 6 using ADO as the connection method ?
Can you help
rgds, Knoxville
Changing An MS Access Password Protected Database From Within VB Code
Hi everyone,
I am trying to allow my application to change it's MS Access database password. I have to have the database password protected but I also need the user to be able to change that password from with my VB application that I am creating.
Thanks in advance.
Thank you for all your help
www.besware.com
Tom
How Do You Code In Visual Basic Writing To An Access Database?
I currently am writing information captured on a form to
a text file which I am importing into Access with VB. I now want to write the information directly to access. What are the steps invloved in doing so. Anyone's help would be
greatly appreciated!!!
Thanks,
Bill
b.ward@vanderbilt.edu
How To Get / Store Image/photo In MS Access Database Using VB ADO Code ?
Sir,
I have one table in ms access with OLE Object type field.
I tried to store the image / photo to database it was successfully inserted in Long Binary data format, but i'm geting error message "Invalid Type format" while retrieve the image using File Concept code (GetChunk Method). like this code
'Declarations
Dim cn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As
String
Const ChunkSize As Integer = 16384
Const conChunkSize = 100
'Code:
'Open Connection and Record set as per normal
Private Sub cmdSave_Click()
rs.AddNew
SavePicture
rs.Update
end sub
private sub SavePicture()
Dim strFileNm as string
DataFile = 1
Open strFileNm For Binary Access Read As DataFile
Fl = LOF(DataFile) ' Length of data in file
If Fl = 0 Then Close DataFile: Exit Sub
Chunks = Fl ChunkSize
Fragment = Fl Mod ChunkSize
ReDim Chunk(Fragment)
Get DataFile, , Chunk()
rs!logo.AppendChunk Chunk()
ReDim Chunk(ChunkSize)
For i = 1 To Chunks
Get DataFile, , Chunk()
rs!logo.AppendChunk Chunk()
Next i
Close DataFile
end sub
Please help me ...
Thanking you
N.Jai Sankar,
pnjaisan@yahoo.com
Connecting To Access Database Via Code / Running A Sql Statement
I am new to VB...and I am trying to add records to an access database through code.
I have a form with a datagrid and 2 datasets on it. I know I can create an add button and VB will do all the work for me, however for this particular task I would like to do it via code using sql statements.
My problem lays with trying to figure out how to execute the sql statment. I've done similar tasks in Java but the connection to a table and the execution were different and I'm not sure how to accomplish this in vb.
Is there anyone that can help me?
Thanks!
|