Opp Access Database Table In DataGrid
Sir,
How can I Open an Access Database Table in Datagrid when Database is password protected ?
Kunal
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Find ALL Access Databases That Have A Linked Table To My Database Table
I have an uncountable amount of links to a highly used table out there on my network. It would take an unthinkable amount of time to track down all links.
Is anyone aware of a way to determine the names or locations of databases that contain a linked table to my table which is being linked to?
I hope this question makes sense. Let me try a very general explanation below in addition.
Tables X, Y, Z... are all linked tables in databases X, Y, Z... to a table T in database T. Is there anyway to find X, Y, Z...?
Thank very much for any info, I am glad to have found VBcity!
Travis
Populating A Datagrid From A Database Table
Hi All,
I currently have a working program which populates data into a ListBox using .AddItem but i want to change it to a DataGrid and I'm not sure how to populate the fields.
I have Module file which has the following procedures to handle Database Connections
Code:
Public Sub Connection()
CConnect.ConnectionString = "TimesheetData"
CConnect.Open
End Sub
Public Sub JobsRecordset()
JobsRecSet.ActiveConnection = "DSN=TimesheetData"
JobsRecSet.Source = "Select * FROM Jobs ORDER BY JobCode ASC"
JobsRecSet.Open "Jobs", CConnect, adOpenDynamic, adLockOptimistic
End Sub
Public Sub CloseJobsRecSet()
JobsRecSet.Close
Set JobsRecSet = Nothing
End Sub
Public Sub CloseConnection()
CConnect.Close
Set CConnect = Nothing
End Sub
I have a form which allows users to Add/Edit Jobs. I have added a Datagrid named dgdJobs and it has 2 columns named "Job Code" and "Job Description". Since I'm using an ODBC connection the Datasource and DataFields for the 2 columns are empty.
I have a procedure that is called with the Jobs Form Activates as follows:
Code:
Private Sub LoadDataGrid()
TimesheetDatabase.Connection
TimesheetDatabase.JobsRecordset
TimesheetDatabase.CloseJobsRecSet
TimesheetDatabase.CloseConnection
End Sub
The part that is missing is how to add the information from the Recordset to the Datagrid.
Thanks
Ferris...
Binding Database Table To A Datagrid Or Listbox
Hi There,
Could someone please give me some pointers as to the best way to achieve the following – I am not really sure whether to use a databound listbox or a datagrid:-
I have a database table that has a column in it which indicates whether the row/record should be included in some statistics that are generated at the end of every month. If the contents of this column are -1 then the row is included in the end of month statistics other it will be 0 and the row will not be included in the month end statistics.
What I wish to do is to allow a user (who will have a certain security permissions when logging into the system) to be able to change which rows/records are included in the month end statistics.
My initial thought was to place the table into a datagrid, but I would like to have a column that basically says “include in month end statistics” and that column will either say yes or no, depending on whether the appropriate column is -1 or 0 respectively – then clicking in the column would allow me to toggle between ayes or no, ideally in a sort of drop down. From what I can see this is not possible with the datragrid control that comes as part of VB 6, but my knowledge of it is quite limited to be honest.
Does anyone know if there is a grid control component out there that might allow me to do something like this (I have looked at component one and can not see anything obvious).
My only other thought at this stage was to place the rows into a databound list box and then allow the appropriate column to be changed by double clicking on the appropriate row ion the listbox.
Any idea / pointers would be much appreciated – thank you.
Newora
Updating An Access Table With A Table From Another Database
I'm trying to update a table using Access 97 and VB5 with an identical table in another database that contains changes- changes within the records, addtions & deletions of records. The update works as longs as there were no deletions or additions. The old table can't be replaced because of existing relationships. If the old table is deleted other information in different tables will also be deleted. Database replication is really not an option. Thanks.
DataGrid Filing From A Access Table
Hi,
I am trying to fill the DataGrid with values of rows and columns from a access table. Can anybody tell me how do fill a DataGrid with table values...
Thanks
Ravi K
Fill A Datagrid From An Access Table
I'm using much of the same code as in my other thread but this time the connection is to an Access database and I'm trying to fill a datagrid.
http://www.tek-tips.com/viewthread.cfm?qid=1197203&page=1
I am not getting any errors but the datagrid isn't filling in.
Module:
CODEConst g_strConnA = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:DataMyData.mdb;"
Public g_oRs As ADODB.Recordset
Public g_oCnn As ADODB.Connection
Public Function GetCallJobs(ByVal SiteID As String) As ADODB.Recordset
Dim oCmd As ADODB.Command
Dim iRetryCount As Long
iRetryCount = 0
Set g_oCnn = CreateObject("ADODB.Connection")
g_oCnn.ConnectionString = g_strConnA
g_oCnn.CursorLocation = adUseClient
g_oCnn.CommandTimeout = 0
g_oCnn.Open
Set oCmd = New ADODB.Command
oCmd.CommandType = adCmdStoredProc
oCmd.ActiveConnection = g_oCnn
oCmd.Parameters.Append oCmd.CreateParameter("@SITE_ID", adVarChar, adParamInput, 15, SiteID)
oCmd.CommandText = "qryJobsBySite"
Set RS = CreateObject("ADODB.Recordset")
Set RS.ActiveConnection = g_oCnn
RS.CursorLocation = adUseClient
Call RS.Open(oCmd, , adOpenStatic, adLockBatchOptimistic)
Set RS.ActiveConnection = Nothing
Set GetCallJobs = RS
Set RS = Nothing 'i tried commenting this out
g_oCnn.Close
Set g_oCnn = Nothing
End Function
How To Fill Datagrid With Selected Access Table
Hi All,
I'm new to VB.Net and I have a problem accessing selected data in an access db. I keep getting the whole table entries in the datagrid, instead of the results of me SQL select.
Can anybody help me.
Thanks
George
How To Import MySql-database Table To Access-database
I'm building a client-database in .NET for my work and I'll have the program copying rows of data from the online MySQL-database to a local offline Access-database. Everything looks alright when opening the local database in Access but when opening it in my app I get an error saying that the index or primary keys will conflict because of duplicates. I have tried endlessly to switch primary keys, creating new ones but nothing seems to help. Any suggestions?
Updating MS Access Table With ADO Data Control From A Datagrid
Hi,
I'm populating a datagrid with the data of a MS access table using ADO Data Control. If I change the datagrid values, its automatically updating the table contents. Is there any property of the ADO data control, so that only on setting that value, the data grid changes should be reflected in the DB & not otherwise.
regards,
narayan
Save What You Can See In DataGrid To MS Access Table?And How To Export To Excel?
Nice to everyone!
I'm barging up against it,when I use the dynamic Access Table as the source of the
Datagrid. How can I save the changes to the Access Table?
I use the "CREATE TABLE myTable(aaa string,bbb string,ccc string)(aaa string,bbb string,ccc string" maybe different,that depend on what you need!) to create MS Access Table, and then
(1) I add a Datagrid named myDatagrid to my form,
(2) Set myDatagrid.datasource=myTable,
(3) Add or Edit the data of myDatagrid,
I have ever want to use the OleDb.dataAdapt and dataSet to update myTable,But I don't know how to write the SQL command.And I can't get the head colume value of myDatagrid.
I think even if I got the colume value,how can I save myDatagrid changes?
!!!!!!!!!!!How can I save changes of myDatagrid to myTable(MS Access Table)
And how Can I export the data of myDatagrid to MS Excel??????????
Guangzhou.China
Edited by - dehuiworkroom@hotmail.com on 12/17/2003 9:33:43 PM
Urgent Help Needed: Problem In Linking Datagrid With Access Table
How can I link datagrid with acces table? After connecting recordset (rs1), I use the following code
Code:
Dim con As ADODB.Connection
Set con = New ADODB.Connection
With con
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = App.Path & "maindb.mdb"
.Open
End With
Dim rs1 As ADODB.Recordset
Dim alldata As String
Set rs1 = New ADODB.Recordset
alldata = "SELECT * FROM main_table"
rs1.CursorLocation = adUseClient
rs1.Open alldata, con, adOpenStatic, adLockOptimistic
Set main_DataGrid.DataSource = rs1
But datagrid show nothing. My recordset is ok becoz if I write
Code:
MsgBox rs1!name
Then it shows the value on the "name" cloumn.
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?
Two Datagrid Access The Same Database
I have two datagrid which access the same database but with different query command.
When i insert a data into the database the 1st datagrid list all the records just fine.
(i automatically refresh the datagrid so it can list the updated records).
But when i tried to list all the records on the 2nd datagrid, it didn't list the records at all until i close the form and reopen it again, the 2nd datagrid shows the records.
What could be the problem ?
This is my snippet codes :
Code:'This is when i clicked the command button, it will list the records on the 2nd datagrid
'ObjPerkiraan is the object from class CPerkiraan
Private Sub Cmd_Cari_Id_Perkiraan_Induk_Click()
ObjPerkiraan.sql = "Select id_perkiraan,nama_perkiraan from master_perkiraan
where is_Group = -1 order by id_perkiraan"
ObjPerkiraan.dapatkanRsMasterPerkiraan
With DG_Id_Perkiraan_Induk
.Columns(0).Caption = "Id Perkiraan"
.Columns(1).Caption = "Nama Perkiraan"
.HeadFont = "Arial"
.HeadFont.Bold = True
.Visible = Not DG_Id_Perkiraan_Induk.Visible
End With
End Sub
'The method from class CPerkiraan
Public Sub dapatkanRsMasterPerkiraan()
Set rsIdPerkiraanInduk = New ADODB.Recordset
rsIdPerkiraanInduk.CursorLocation = adUseClient
rsIdPerkiraanInduk.Open sqlPerkiraan, con, adOpenKeyset, adLockOptimistic
'rsIdPerkiraanInduk.Resync adAffectAllChapters
Set FrmMasterPerkiraan.DG_Id_Perkiraan_Induk.DataSource = rsIdPerkiraanInduk
FrmMasterPerkiraan.DG_Id_Perkiraan_Induk.Refresh
'Set rsMasterPerkiraan = Nothing
End Sub
Thanks.
Edited by - erc on 3/25/2004 9:30:44 PM
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
Exporting An Access Table To Another Access Database From VB
Hi,
I would like to know if I there's any easier way to export tables from one Access database to another access database. I have password protected my main Access database. So that the user can access the database via VB front-end (ADO) and not through Access.
However, I need to export the tables (and only tables) to another Access database. I tried using two methods;
1) 'INSERT ALL' SQL statement to perform this action and
2) Using two recordset objects - one for the source database table and the other for the destination database table.
Can someone give me a better idea?
Many Thanks,
Terry
terry_jha@hotmail.com
Using A DataGrid With Coded Database Access
Hello, I have been stumped on this problem for a while.
I am need of how to correctly write the code to handle access to a database for a datagrid *without* using the ado data control itself.
I have it down pat how to connect to a database via code only for other controls, but with the grid, I get errors about bookmarks or something.
This is for a program I wish to distribute later, and so cannot have the ADO control hard coded with the location of the database.
I have tried taking an ADO control, setting up the connection string, then cut and paste that connection string to the Form Load sub, so I could change it to use app.path, but leaving the connection string blank (in the properties of the control at design time) errors out.
Any suggestions to this would be greatly appriciated! Thank you for your time.
-Greg
Datagrid Saving To A Access Database
Hello
I am using a datagrid and l would like to update and save the contents to the access database. The customer would like to have an excel style grid, that they can navigate and edit details to it, then update. And also they like to be able to add a new record and add that to the database.
I am using the data environment, as l needed to print some reports (working ok)
Code so far.
Code:
'updating
deCustomers.rsCmdCustomers.update
'saving
deCustomers.rsCmdCustomers.save
Many thanks in advance
Steve
Connecting A DataGrid To An Access Database
Hi All
Please help. I've created the following code to connect a DataGrid to an
Access database using ADO code, but the datagrid is empty at run-time? Any
suggestions?
'Add Questions to the Questions List Box
adComm.CommandText = "tblQuestions"
adComm.CommandType = adCmdTable
Set adRS.Source = adComm
adRS.Open
If Not adRS.EOF Then
adRS.MoveFirst
Set grdQuestions.DataSource = adRS
End If
Thanks
Debbie
Relations Between DataCombox And DataGrid Using Access Database
Well, my problem is basically:
I have an Access DataBase with information about schools. I built a form with 2 combobox and 1 datagrid. I can´t relationate the 2 combobox. I need:
1º - Select rows from the first combox and put only this information at the second (E.g At the first combobox (ComboCountries) I list all countries. So, when I click at the ComboCountries_click() I need to select one country and after, only the cities of that countries will appear (at the second combobox named ComboCities).
At the same time I need put in a datagrid the information of schools relationated with that 2 combox.
2º When a select one row at the datagrid, how can I create a link to another form showing the information of that selecting row?
Who can help me?
Thanks very much!
Datagrid, Saving And Updating To Access Database
Hello
I am using a datagrid and l would like to update and save the contents to the access database. The customer would like to have an excel style grid, that they can navigate and edit details to it, then update. And also they like to be able to add a new record and add that to the database.
I am using the data environment, as l needed to print some reports (working ok)
Code so far.
Code:'updating
deCustomers.rsCmdCustomers.update
'saving
deCustomers.rsCmdCustomers.save
Many thanks in advance
Steve
EXE Program Don't Populate Access Database Into Datagrid
Hi,
when I copy an exe file to another computer (only window2000 installed, no visual studio and no access installed), the program run but didn't populated data from Access database into the dategrid (It worked with the computer with vb and access installed). Do I need to installed some driver or component to make it work? Thanks.
Need Help With Adding Records To Access Database By Using A Datagrid
I have an Access database installed on my Windows NT4 PC.
I am accessing the database table records from a VB6 program
that I wrote. I have the "Working Model Edition" of VB6
installed on my PC.
I am displaying te contents of a user specified table with a
combination of a datagrid control and an ADO data control.
The code which loads the database table contents into the
datagrid is located in a "module" which is included
with the VB project. The display of the data works fine.
I then modified the program to add a "modification" form and
added the "appropriate" new code to the "global items module".
The modification of table records worked fine.
I then created a form and new code to handle "record additions".
The "add a new record" row is displayed at the bottom of the data
grid (i.e. a blank row with a "*"). However, when I position my
cursor into the "add a new record" row I can't type anything. I
even tried setting the ado data control mode parameter to
"adModeReadWrite" at both design time and run time. This did not
solve the problem.
Here is the code from my "global items module" which handles the
display of the datagrid.
Public Sub AddTableContents(strTableName As String)
' Display the specified table in the form "frmTableAdd"
' inside the DataGrid named "dgrAddGrid" using
' an Adodc control. This grid allows record additions.
frmTableAdd.lblTableAdd.Caption = "Contents of table " & _
strTableName
frmTableAdd.adoTableAdd.CommandType = adCmdTable
frmTableAdd.adoTableAdd.RecordSource = strTableName
frmTableAdd.adoTableAdd.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;User ID=Admin;Data Source=F:Program FilesMicrosoft Visual StudioVB98
ewBiblio.MDB;Mode=Share Deny None"
frmTableAdd.adoTableAdd.Mode = adModeReadWrite
Set frmTableAdd.dgrAddGrid.DataSource = frmTableAdd.adoTableAdd
frmTableAdd.Show vbModal
Exit Sub
End Sub
Any ideas on what I have to change in order to be able to add new records ?
TIA for your help.
Puting Data Into A DataBase (VB6, ADO, ACCESS, DataGrid)
Old in basic/vb but new to this part of database with VB6.
Have created an ACESS Database with several tabels.
Have a VB6 project with several forms.
ACESS, ADO, Jet 4.0 and DataGrid.
If I make a textbox and connect it to the database and say
DataBase.Recordset.AddNew
then I can add text into that textbox and this goes into that database.
So far no problem.
But now I want a value I have in a string, TextString, to be put into the database. In fact I have several such strings I want to be put into various Fields in the new Data.
But I am not able to.
Have tryed to put this text into the TextBox. But this does not get transfered into the database. Strange to me as if I type "manually" it does.
Maybee some settings or ---
So how can I send a textstring direct to a field in the database?
Have a nice day
Per
Get The Table Names Of An Access Database With VB6
How to get the table names of an Access Database with VB6?
Hi,
I'm working on an automation project with a VB6 program and a MS Access database. The database can contain more than one table. The tables have to filled with data obtained with a VB6 program.
Is there a way to get the table names of an Access Database with a VB6 application? That is, run a routine in the VB6 program which gives you the table names?
It's no problem tot connect to an Access Database and to a table and to write to / read from the table, if you already know the name of that table.
Code:
'parts of the code:
Dim MyDatabase As ADODB.Connection
Dim MyDatabaseTable As ADODB.Recordset
Set MyDatabase = New ADODB.Connection
MyDatabase.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" &
MyDatabaseName$ & ";"
Set ADatabaseTable = New ADODB.Recordset
ADatabaseTable.fields(1) = "some text"
'etc
This works fine.
But when there are more tables in the database, how to get the names of the tables from within VB6? So I can choose the table from within VB6.
Thanks in advance.
Copy Table From MS Access Database
I am having a problem copying a table from an existing database into a new (active) database. I am able to link the table, but I want to copy the structure only. The below code is for the linking of the tables. I have tried the CopyObject and TransferSpreadsheet commands, but those attempts were unsuccessful. Any help is greatly appreciated. Thanks.
Function AttachTab(TableName As String, ConnStr As String) As Integer
On Error Resume Next
Dim db As Database, MyTableDef As TableDef
Set db = DBEngine.Workspaces(0).Databases(0)
DoCmd.DeleteObject A_TABLE, TableName
On Error GoTo Error_AttachTab
Set MyTableDef = db.CreateTableDef(TableName)
MyTableDef.Connect = ConnStr
DoCmd.CopyObject , , acTable, TableName
MyTableDef.SourceTableName = TableName
db.TableDefs.Append MyTableDef
GoTo End_AttachTab
Error_AttachTab:
AttachTab = False
Exit Function
End_AttachTab:
AttachTab = True
End Function
Database (access) Have 3 Unrecognize Table
i'm using access as my database. the database have 6 table. last time i use ADO, and there is no probleem to display the table name.
recently, when i try to use ADO, it appear 3 extra table. the table are: MSysModules2, MSysModules and MSysAccessObjects.
there are no such table when i check my database. what wrong with my database? the database is 97 format.
Another question.
i display my database using datagrid. can i insert checkbox for every rows data? i want to select some data using checkbox
How To Read From A Table In MS Access Database?
Hello!
I would be grateful if someone could help me how to read from a specific table in a MS Access database.
I know how to write there, but I do not know how to read. For writing I use the following syntax:
Set oDB = OpenDatabase(DataFolder & "" + ProjectName + ".mdb")
Set appAccess = CreateObject("Access.Application")
With appAccess
.Visible = False
.OpenCurrentDatabase oDB.Name
End With
Set rstTerminal = _
oDB.OpenRecordset("Terminal")
With rstTerminal
.Edit
!Flag_State = 0
.Update
.Bookmark = .LastModified
.Close
End With
__________________________________________________
I would like to read from Flag_State, something like this:
Variable=Flag_State
Thank you in advance.
Miha
How Do I Show A Table Of Access Database
hi, i have a problem, is that how do i view the database in datasheet in the vb program....
mean that when i click on a button, the program will show mi the whole database in a datasheet in the program....
Ah Xing
Get The Biggest Table In Access Database
how could i get the biggest table in my database
by recordecount ?
for example i have 3 tables in my database the firest have a 10 recorde's Tb.recordecount=10
the 2 have 28 recorde Tb.recordecount=28
the 3 have 18 recorde Tb.recordecount=18
how could i get the biggest table name by nice code
How To Delete Table In Access Database
You want the SQL "DROP TABLE" command
eg:
Code:
On Error Resume Next
db.Execute "CREATE TABLE tblTemp(f1 TEXT,f2 TEXT)"
If Err.Number = 3010 Then 'temp table exists
db.Database.Execute "DROP TABLE tblTemp" 'delete the temp table
db.Execute "CREATE TABLE tblTemp(f1 TEXT,f2 TEXT)"
End If
On Error GoTo ErrHandler 'reset error handler
Attatch SQL Table To Access Database
I am using DAO 3.6 to create an Access database and then attach an SQL table to the database. I can open the Access database and open the SQL table which has been attached, but the attached SQL table is read only.
I need to update fields in the SQL table so I need a read-write connection.
This is the code I have:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim tdf As DAO.TableDef
'Create and open db
Set db = DAO.CreateDatabase(strDB, dbLangGeneral)
Set db = DAO.OpenDatabase(strDB)
'Set connection string
strConnect = "ODBC;DRIVER=SQL Server;SERVER=myServer;DATABASE=myDatabase;UID=sa;PWD=Password"
'Create tabledef
Set tdf = db.CreateTableDef("LocalTableName", dbAttachSavePWD, "RemoteTableName", strConnect)
'Append tabledef
db.TableDefs.Append tdf
Table Corruption In Access Database.
A table in my database keeps corrupting. The error I get when trying to rebuild is: Could not find field 'Description'. The rebuild fails. and I have to restore the database. This has happened twice in the last 2 weeks.
If I try to open the table in access 2000 I get a message:
This object requires a newer version for the microsoft jet database engine.
The table has about 150 fields. I have no idea as to what might be causing this corruption.
Check To See If An Access Table Is In A Database
Hi, thanks in advance, I am working on a vb6 project using ado, I have connection into a access 2000 database I would like to know the commands to check to see if a table exists in the mdb.
I have the I have the stuff to delete the table but I get an error if the table is not there. and what I would like to do is just continue on the next record. I want to stay away from "on error resume next" if I can.
any suggestions
here is the section of code
cn.Execute "DROP TABLE TempData", dbFailOnError
Yes I know that I have dbFailOnError but not sure what else to put in there?
Thanks again
Jim
HTML Table To MS Access Database
Assalam o Allakum (Hello)
well pals this is my first day on vbCity....
but with a problem
the problem is that i want to shift some data from a webpage that is on www.kse.com.pk ( Makrket Data --> Market Summary page)
or i think you can also log on to this page using this link http://www.kse.com.pk/kse4/phps/mktsummary.php
actually i want to shift this data to any database (suppose MS Access), after shifting this page's data to database then the next step is to compare the Rates of two companies which is i think easier...
and i want to do this in Visual Basic 6
so what else... i need help as i am not that much expert in VB 6
thanks and regards !
khalid_baoo@hotmail.com
Khalid Mehmood Awan
Allah Hafiz (God May Protect you)
Get The Table Name List From The MS Access Database
Hello Guys,
I found the simple way to get the table names from the access database. See the following snippet.
Code:Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set rs = g_cnnConnection.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
Do Until rs.EOF
MsgBox rs!table_name
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
I hope it will be useful for you.
Enjoy.
Thanks
Kamlesh Gujarathi.
Kamlesh@itshastra.com
Fly always to the SKY. You can do anything if you TRY. ;)
Cant Delete Row From Table (access Database)
This code is supposed to delete a row in my access-database. But its just giving me a "update requires a valid deletecommand when passed datarow collection with deleted rows "-message.
I find this a bit strange, since the commandbuilder has been working when I want to update and insert rows.
Code:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim strConnect, SQL As String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User Id=admin;Data Source=Datadb.mdb"
Dim strSelect As String = "SELECT * FROM data Where ID1=" & findId.Id 'findid being a global module
Dim Connect As New OleDbConnection(strConnect)
Dim MyDataSet As New DataSet
Dim myCB As OleDb.OleDbCommandBuilder()
Try
Connect.Open()
Catch
MessageBox.Show("Databas ej tillgänglig.")
End Try
If Connect.State.Open = 1 Then
Try
Dim Adapter As New OleDbDataAdapter(strSelect, Connect)
'Load a data set.
Adapter.Fill(MyDataSet, "data")
'MessageBox.Show(Adapter.DeleteCommand().ToString)
Dim Table As DataTable = MyDataSet.Tables("data")
rows = Table.Select()
Table.Rows.Remove(rows(0))
Adapter.Update(rows)
Adapter.Update(MyDataSet, "data")
Table.Clear()
Adapter.Dispose()
Connect.Close()
Catch ex As Exception
MessageBox.Show("Fel: " & ex.Message)
End Try
End If
lstItems.Items.Clear()
loadDB() 'reloads the items in the listbox named lsitems
End Sub
Anyone who has any good tips? Im using a modem dial up-connection where I am right now, so I cant google to much because many resulatlinks goes to pages that are to slow for my connection.
Access Database Table From 2 Forms
I am using 2 forms in 1 project. Is it possible to access a database from both forms? Or does that cause a sharing problem? My 1st form will access the database, but I can't get the second form to access the database. I am trying to use the Adodc control in each form. This doesn't seem be possible.
Delete Table In Access Database
How can I delete table in Access Database?
I try with this:
Dim dbsNew As Database
Dim wrkDefault As Workspace
Dim td As TableDef
Set dbsNew = OpenConnection("c:WindowsTempMarteleurVirtuel.mdb")
Set wrkDefault = DBEngine.Workspaces(0)
td.Name = "Position ha"
dbsNew.TableDefs.Delete td
But it was not a success. I recive an error at the last line: ("Type mismatch")
Has anyone can help me?
Thanks!
Redg
Importing A Table In A Database Access In VBA Under Word
Hello,
Is it possible to import a table in a Database (actually a .dbf file) access in VBA under Word.
In fact, i want to do something like :
DoCmd.TransferDatabase acImport, "dBase 5.0", "<path>", acTable, "<my_file>.DBF", "<name_of_table>", False
Thank you
PS : This is quite urging :-)
|