(vb6)Insert Data In The Access Table
Hon'ble gurus, I use VB6 and Access2002 database and ADODB. I have 2 tables created in my .mdb file. Both the tables have a common field MyCode. I want that a particular data row(which is typed in a textbox) has to be deleted from table1 and should enter in table2. With regard to deletion I use like: con.execute "delete * from table1 where MyCode= '" & Text1.text & "' " But, how can I insert that particular data in table2 ? Please advise me. Thanks and regards.
pkb_pkb
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Insert Temporary Data In Access(table) Using Data Grid
How to insert data into a table using a data grid.
A little background,i am using SS TAB in my forms i need to hold data temporarly im my data grid
and then finaly at click it should be inserted in the table.The SS TAB is linked to ADOC,which is inturn
linked to the table in access.
How To Insert Temporary Data In Access(table) Using Data Grid
How to insert data into a table using a data grid.
A little background,i am using SS TAB in my forms i need to hold data temporarly im my data grid
and then finaly at click it should be inserted in the table.The SS TAB is linked to ADOC,which is inturn
linked to table.
Edited by - manav74 on 10/29/2003 1:01:07 AM
Insert Access Data Into Word Form Table Cells
Hi everybody
I have a Word form template with a vba command button (“User Name”) placed in a table cell. The command button displays a vba form with a list of employee names taken from an Access table along with a “Cancel”, “Clear” and “Ok” button. A user selects a name which is then inserted in an adjacent table cell on the word form.
Just this above-mentioned procedure has taken me Weeks to put together. Most of the code and advice came from the VB City forum, so I have you guys to thank for everything.
So, back to my plea for help. The form template also contains word text fields that users must complete, for example, job title, unit and personnel number etc. However, this information is also available in the Access table. So I thought to myself, wouldn’t it be great if this data could somehow be inserted into the various table cells on the word form instead of using basic text fields.
Currently, I can only manage to call one column of data from the Access table and populate a dropdown list and insert one name into a table cell (see code below). I would love to be able to list all Access table details and for those details to be placed in various table cells on the form.
Any assistance would be greatly appreciated.
Kind regards
Arabella
Code:Private Sub EMSA_Staff_Clear_Click()
ClearCell
End Sub
Code:Private Sub EMSA_Staff_Ok_Click()
Dim i As Integer
Dim s As String
Dim strSel2 As String
Dim strOther2 As String
'ActiveDocument.ListBox1.Clear
s = ""
s = ActiveDocument.Tables(1).Cell(2, 2).Range.Text
s = Mid(s, 1, Len(s) - 2)
If Len(s) > 0 Then
s = s & ", "
End If
ClearCell
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) = True Then
strSel2 = Me.ListBox1.List(i) & vbNullString
If strSel2 = "NON-EMSA Personnel" Then
strOther2 = InputBox(prompt:="Please enter name.", Title:="Non-EMSA Personnel")
If InStr(1, s, strOther2 & ", ", vbTextCompare) = 0 Then
s = s & strOther2 & ", "
End If
Else
If InStr(1, s, strSel2 & ", ", vbTextCompare) = 0 Then
s = s & strSel2 & ", "
End If
End If
End If
Next i
If Len(s) > 0 Then
s = Mid(s, 1, Len(s) - 2)
ActiveDocument.Unprotect
ActiveDocument.Tables(1).Cell(2, 2).Range.InsertAfter (s)
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ClearCell
End If
Unload Me
End Sub
Code:Private Sub Lead_Emsa_Person_Cancel_Click()
Unload Me
End Sub
Code:Private Sub UserForm_Initialize()
On Error GoTo UserForm_Initialize_Err
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=S:ITemsa staff details.mdb"
rst.Open "SELECT DISTINCT [Name] FROM Staff ORDER BY [Name];", _
cnn, adOpenStatic
rst.MoveFirst
With Me.ListBox1
.Clear
Do
.AddItem rst![Name]
'.AddItem rst![Title]
rst.MoveNext
Loop Until rst.EOF
End With
UserForm_Initialize_Exit:
On Error Resume Next
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Exit Sub
UserForm_Initialize_Err:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Error!"
Resume UserForm_Initialize_Exit
End Sub
Code:Private Function ClearCell()
ActiveDocument.Unprotect
ActiveDocument.Tables(1).Cell(2, 2).Range.Delete
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Function
Insert Access Table From VB
I have a form in Access and want to create tables in my Access database when I click a button, using coding in the click event. Can anyone tell me how to do this or point me to a web site that explains this? Access help does not tell you how to create tables using coding, only through wizards. I know SQL, but obviously just inserting the proper SQL statement is not possible.
Within a form, I want to create a table (within the code) inside the same .mdb file.
Thanks..
Access VBA - INSERT To Table
G'Day Guys,
Im stumped here trying to copy a string into an existing field of an Access
table (The code is written in VBA).
Heres what I have so far (maybe I'm doing it wrong):
VB Code:
Dim db As Object Dim d As String: d = "testing" Set db = CurrentDb() Dim s As String s = "insert into CD-Blank(File_Name) values (' " & d & " ')" db.Execute s
Cheers,
Bruce.
How To Insert Data From A Table Using Sql?
I would like insert a data to a table but the other field in the table are located on the other table. how can i merge the datas into one table?
sample illustration:
tblcustomer: tbldelivery:
custcode trackno
custname shipdate
custadd custcode
custname
how can i merge the table on tblcustomer going to tbledelivery?
HELP: INSERT DATA INTO TABLE!!
OKay, I get a error msg saying that one of my fields cannot be a zero-lenghted string. i.e ""
How can I get round this problem? Is there anyway to check the fields properities and see if it is allowszerolength data?
I belive I am using ADO and maybe DAO
HELP PLEASE!!
----------- CODE TO INSERT DATA TO TABLE ---------------
With dbdata.rstmpCardHolderDet
.AddNew
For i = 0 To UBound(mField) - 1
Debug.Print i; .Fields(i).Name
'if the fieldtype is TEXT
If .Fields(i).Type = Adodb.adVarWChar Then
.Fields(i).Value = RTrim(mField(i))
Debug.Print .Fields(i).Value
'if the fieldtype is DATE
ElseIf .Fields(i).Type = Adodb.adDate Then
.Fields(i).Value = CDate(RTrim(mField(i)))
Debug.Print .Fields(i).Value
'if the fieldtype is LONG BINARY
ElseIf .Fields(i).Type = Adodb.adLongVarBinary Then
.Fields(i).Value = mField(i)
Debug.Print .Fields(i).Value
'if the fieldtype is LONG TEXT
ElseIf .Fields(i).Type = Adodb.adLongVarWChar Then
.Fields(i).Value = RTrim(mField(i))
Debug.Print .Fields(i).Value
'if the fieldtype is anything else turn it to integer
Else
.Fields(i).Value = Val(RTrim(mField(i)))
Debug.Print .Fields(i).Value
End If
Next
.Update
End With
How Can I Insert A New Record Into An Access Table From My VB App?
VB version 6.Access version:2000
I am developing a Web browser application.I want to update my Url&Date table with every user's URL request plus the current date.I 've tried it through the folowing code but I get a "User defined type not defined" error.Do you know why?
Private Sub updateDB()
Dim cn As ADODB.connection
Dim sInsert As String
Dim myDate As Date
sInsert = "INSERT INTO TABLE Url&Date cboAddress.text,myDate"
Set cn = New ADODB.connection
cn.ConnectionString = "I am now inserting a new record.."
cn.Open
cn.execute sInsert
cn.Close
Set cn = Nothing
End Sub
Note:cboAddress.text is the URL. I believe that I do not use it properly because it is on double quotes ("").Sould I store it first to a variable?
Tryin To Insert Into A Access DB Table
Hi
I am tryin to insert into a table two dates. The 2 date fields in the access db are in a date/time type
My Code is
Difference = DateDiff("d", DTPicker1.Value, DTPicker2.Value, Now)
'Insert data into the database
strInsert = ""
strInsert = "Insert into [LeaveSchedule](Employee,[Start Date],[End Date],[Leave Days])"
strInsert = strInsert & "Values(" & "'" & Combo2.Text & "'"
strInsert = strInsert & "," & DTPicker1.Value & "#"
strInsert = strInsert & "," & DTPicker2.Value & "#"
strInsert = strInsert & "," & Difference & ")"
I am getting again a TYPE MISMATCH
Please help
Checking 2 Table Before Insert Data
currently i building a system that need to check 2 table in a database before updating the data to the first table. i able to check the data with the first table in order to see whether have any duplicate data or not but i also need to check the data against the second table before i insert the data to the first table. do anyone have any idea how to do it. it is urgent and all the help is most appreciated.
Insert Sql Data Into As400 Table!?!
HELP - WHAT IS THE QUICKEST WAY THAT i CAN LOAD DATA FROM A SQL SERVER TABLE TO A TABLE ON THE AS400. I HAVE MY ODBC SETUP FOR BOTH AND NOW ALL I HAVE TO DO IS SELECT * FROM THE SQL TABLE AND INSERT THEM ALL INTO THE AS400. URGENT NEED!
tHANKS
Insert Data From A Fort Into A Table Using WBA
Hi!
I have a problem with inserting data from a form into a table.
I want it to work like this:
A user can write values in textboxes in a form, and after that a command button should put the values into a existing table.
Ex. table cars(type, color)
the form should then consist of two textboxes (and a command button). When the user has inserted the values, the command button should insert the values into the table.
Can someone help me?
In VB6, How To Split The Name Of Table For Insert The Data
Example: table name ttad120500,ttad120200,ttad120600,ttad120100
you will see that the different in the 3 digits.
500,200,600,100. The user can select the table to insert the data but it just only choose 500,200,600,100. How to coding in VB?
Best Regards,
Namwan
How To Do Bulk Insert From Access Table Into Sql Server
Hi
I want to do a bulk insert from Access table into SQL Server table
Currently I am doing 1 record at time with the hlep of recordset .But it is taking too long .
Also I should be able to manange the insert srtring because it is not a direct table to table copy
Is it possible to do using Vb 6.0 code
Thanks in Advance
Insert A Record In A Ms Access Table With 3 Relationship
My name is Kervin!
I have made a data base in ms access. The db consist of 4 table, one of them has 3 relationship from the other table. Student, Faculty, Rules and Demerits. I can insert to the first 3 but when I try to insert a record in the 4th one an error 91 <object variable or With block not
Set> is making me crazy. When I try to Edit a record the same error is show. I can resolve the Edit error deleting first the record and once the record is on text box I can insert it edited. But I can insert on Demerits table. I'm using a ADO Jet 4.X to comunicate with ms access from VB.
The code is:
With frmDemerit.AdoDemerit.recordset
.addnew
.field("SID") = txtSID.text
.field("FID") = dbcFID.text I'm using a data combo
.field("DCode") = dbcDCode.text " "
.field("Date") = txtDate.text
.update
If any body know another way to insert or know the cause of my error, and want to help me, please! please! is my software Eng. final project.
In the name of God HEEEEEELP me please!
Insert Distinct Records In A Table (Access VBA)
I need to insert "distinct" records in one table with a sql statement.
Following is the statement:
xSQL = "INSERT INTO HeaderFile ([Date], [Grp], [Reg], [ServLoc], [AcctNo], [InvNo], [Unit]) IN '\C:MyDB.mdb' SELECT DLFile.Date, DLFile.Grp, DLFile.Region, DLFile.ServLoc, DLFile.AcctNo, DLFile.InvNo, DLFile.UNIT FROM DLFile WHERE DLFile.Grp = """ & ProcGrp & """"
The DLFile contains the same information (except unit) on each line. (I didn't set up the database but I have to live with it.)
So what I would like to do is only insert the unique records baseed on Date, Grp, Reg, ServLoc, AcctNo, InvNo, and Unit.
I've seen some examples of selecting distinct records, writing them to a temp table and then writing them to the HeaderFile table from the temp table.
I'm hoping that I can do it right from the INSERT statement.
Thanks for the help.
Insert Records Into Access Table From A Form
Hi,
I am having problem inserting records into a access table that I have created. I have a table called tblClient and a form called frmAdd and I have an Add button in the form, which has a click event procedure and I have written the code to insert into the table, but for some reason when I hit the add button the record does not insert into the table. I get no errors either. Below is the code that I have written. Any help would be greatly appreciated. Thanks
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
DoCmd.GoToRecord , , acNewRec
CurrentDb.Execute "INSERT INTO tblClient (Date Received, FullName) VALUES (" & Format(txtDateReceived.Value, "mm/dd/yyyy") & ", '" & txtFullName.Value & "')"
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
Insert Data Into MySQL Table Using A .dat File
Hi
I was running through a MySQL tutorial yesterday, and the author mentioned the possibility of streamlining the data insert process via .dat files. Unfortunately, the author did not provide much information on actually completing the task.
I have attached the .dat file that would be used for the insertion of data. (I attached it as a .txt file becuase this web-forum does not allow the uploading of .dat files)
If anyone could instruct me in using this file to insert data into a MySQL table, I would greatly appreciate it!
Thanks
Insert Data Into Tables And Joiner Table
I have this schema that includes a Joiner table in my Access 2000 database.
I understand I can insert more than one Project Worker per Project and I assume I will need three insert statements.
The question I have is how do you do that in my insert statements if for example on my Cold Fusion front end I have entry for two Project workers for a Project?
Code:
Project Table:
projectID - Primary Key
projectRequirement
Worker Table:
workerID - Primary Key
workerFirstName
workerLastName
workerPhone
workerEmail
ProjectWorker Table:
projectworkerID - Primary Key
projectID - Foreign Key
workerID - Foreign Key
Here is my attempt but not sure if this works. And dont I need to get the last(or most recent) foreign key values in the ProjectWorker table? Please advise.
Code:
Insert into Project (ProjectID, ProjectRequirement) values (ProjectIDvalue,'ProjectRequirementValue');
Insert into Worker (WorkerID, workerFirstName, workerLastName, workerPhone,workerEmail) values (WorkerIDvaluehere,'workerFirstNameValue','workerLastNameValue','workerPhonevalue','workerEmailvalue');
Insert into ProjectWorker (projectworkerID, projectID, workerID) values (projectworkerIDvalue, projectIDvalue, workerIDvalue);
Insert Data From A Text File To A Table
When i use the following insert statment it fails to open the text file, read the lines of data, then insert into my table. However when i hard code the data i.e.
'str_recordid = "test"
'str_acno = "test"
It works!!
What am i doing wrong?
xxG
'Open the database
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; " _
& "Data Source = c:windowsdesktop racking.mdb"
cn.Open
'Open the text file
Set ts = fso.OpenTextFile("c:windowsdesktop10010253136471.txt")
recordid = Mid(sStringToBreakDown, 1, 1)
acno = Mid(sStringToBreakDown, Len(recordid) + 1, 9)
'Open the table
rst.Open "SELECT * FROM tbl_headerrecord", cn, adOpenDynamic, adLockOptimistic
If rst.EOF Then
strsql = "INSERT INTO tbl_headerrecord (recordid,acno)" & _
"','" & "VALUES ('" & str_recordid & "','" & str_acno & "')"
Else
strsql = "UPDATE tbl_headerrecord SET recordid='" & str_recordid & "',acno='" & str_acno & "'"
End If
cn.Execute strsql
How Do I Use Visual Basic To Insert Data Into A Table
I'm tryin' 2 insert data into an SQL SERVER database table when a button is clicked. The sad thing is that i don't now a thing about VB and i gotta make it or im gonna fail the exam....so how can i use the button_onclick() function(i don't have VB knowledges but i've made some projects in Java using Oracle and MySQL)...could someone explain me the basics of how to connect to SQL SERVER and how to make queries using VB?
I'm really lost and I hope someone will give an advice..so pls feel free to answer..pls..pls....s
URGENT(VB6)Insert Into Table The Data Of DataGrid
Hon'ble gurus,
I use VB6 and Adodc1 and Access2002 database. How can I insert data of the DataGrid into the table? When I want to show Adodc1 data in a DataGrid, I use like this and the data is seen in the DataGrid.(MyName is a fieldname in the Table)
Set DataGrid1.DataSource = Adodc1
Adodc1.Recordset.Filter = "MyName='" & Label1.Caption & "' "
DataGrid1.Refresh
can I write like this?
Con.Execute "insert into Table1 values( DataGrid1.recordset )
Please help me. Thanks.
pkb_pkb
Insert Data Into A New Table MSACCESS -RESOLVED
I have a new table that i created
I want to be able to use the results from the select statement below to be inserted into the new table once I click a button.
LSQL = "select * from paymentDPA"
LSQL = LSQL & " where tklast LIKE '*" & LSearchString & "*' And lmatter LIKE '*" & LSearchString1 & "*'And (ltradat Between #" & LSearchString2 & "# And #" & LSearchString3 & "#)"
then delete the data from the table once I export it into Eexcel
Can someone please help??
Thank You
Edited by - dtttj on 8/31/2006 2:17:36 PM
Access Function To Return Table And Insert Values
I've done this kind of thing in SQL server but cant figure it out in VB/Access
I want a function to return a table I can JOIN on with other tables.
I think this function creates the table but how do I insert the values ?
Code:Function func_DateRangeMonth(dtStartDate As Date, dtEndDate As Date) As Table
Dim dtCurrentDate As Date
If dtStartDate < dtEndDate Then
dtCurrentDate = Month(dtStartDate) & "/01/" & Year(dtStartDate)
dtEndDate = Month(dtEndDate) & "/01/" & Year(dtEndDate)
func_DateRangeMonth.Columns.Append "MonthBegin", adDate
While dtCurrentDate <= dtEndDate
' some code to insert into this table
dtCurrentDate = DateAdd(mm, 1, dtCurrentDate)
Wend
End Function
this is the SP im trying to recreate
Code:CREATE FUNCTION dbo.func_DateRangeMonths(@StartDate DateTime, @EndDate DateTime)
RETURNS @Results TABLE (MonthBeginning DateTime)
AS
BEGIN
IF @StartDate >= @EndDate
BEGIN
RETURN
END
DECLARE @CurrentDate DateTime
SET @CurrentDate = CONVERT(nVarChar, MONTH(@StartDate)) + '/01/' + CONVERT(nVarChar, YEAR(@StartDate))
SET @EndDate = CONVERT(nVarChar, MONTH(@EndDate)) + '/01/' + CONVERT(nVarChar, YEAR(@EndDate))
WHILE @CurrentDate <= @EndDate
BEGIN
INSERT INTO @Results (MonthBeginning) VALUES (@CurrentDate)
SET @CurrentDate = DATEADD(mm, 1 , @CurrentDate)
END
RETURN
END
----------------------------------------------------------------------------
Dan Bayley
Affordable website design UK
Free Google & Yahoo sitemap generator
What Is The Syntax Of Create Table And Insert Statement For Access 2000 Db.
What is the syntax of create table and insert statement for access 2000 db.
I want to paste the create table and insert statement to access 2000 "sql view window".
Therefore i want the correct syntax and format for these statements.
The reason that i want do this is that I created an application that generates create
table and insert statements for access db and this way i want to test my application if it
generated the statement correctly.
Insert Data Into A Row In A Database Table In SQL Server With Visual Basic
I figured out the how to retrieve data from SQL, but I have not managed to add data to a table.
Here's what I've got so far. I would appreciate it greatly if somebody could fill in the blanks that would make this procedure work and insert the data.
Public Sub AddToDatabase()
Set RCconn = New adodb.Connection
Set TuneCMD = New adodb.Command
' Establish Recordset
Set Results = New adodb.Recordset
'Establish a Connection
With RCconn
.Provider = "SQLOLEDB"
.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Tuneman"
End With
'Open the connection
RCconn.Open
Results.CursorType = adOpenStatic
Results.CursorLocation = adUseClient
Results.Source = "INSERT INTO OrderInfo VALUES('" & frmAddMusicData.txtBand.Text & "')"
Set Results.ActiveConnection = RCconn
Set Results = Nothing
RCconn.Close
Set RCconn = Nothing
End Sub
Passing Data From A Query Table To An Aggregate Table(MS Access 2000)
hello....I am currently developing an accounting system for a specific company here in the Philippines...Can anybody help me or give me a code...I have an aggregate table named AggSales to be used as a source data for my report(Crystal Report 8.5), which is a comparative Profit & Loss report of two months...Now my problem is, i want to pass data from a query table named qryGenLedger to the AggSales table by which the user will select a month and a year of their choice(Month1,Year1 and Month2, Year2)...so that the data in the AggSales will be composed only by Dates which matches the choice of the user(Month1,Year1 and Month2,Year2)...thanx...please help!!!
Passing Data From A Query Table To An Aggregate Table(MS Access 2000)
hello....I am currently developing an accounting system for a specific company here in the Philippines...Can anybody help me or give me a code...I have an aggregate table named AggSales to be used as a source data for my report(Crystal Report 8.5), which is a comparative Profit & Loss report of two months...Now my problem is, i want to pass data from a query table named qryGenLedger to the AggSales table by which the user will select a month and a year of their choice(Month1,Year1 and Month2, Year2)...so that the data in the AggSales will be composed only by Dates which matches the choice of the user(Month1,Year1 and Month2,Year2)...thanx...please help!!!
Append Data To Access Table From External Sybase Table
Hi there,
I have created a table in MS Access using ADOX - identical structure to a table which resides on a Sybase ASE 12.x server on another machine. My goal is to copy the contents of the Sybase table into the MS Access table on my PC. I have been trying to do this for two days now and can't figure it out.
I am using ADO to establish connection to the Sybase database. I can read the table I need, populate a datagrid with it, etc. But I don't know how to copy its contents to my access database.
I have tried the code below to no avail. Any suggestiong would be appreciated. Thanks in advance.
' Definitions
Dim ConnString, strSQL As String
Dim rprobDBConnect As New ADODB.Connection
' Close the remote connection if it's already open
If rprobDBConnect.State = adStateOpen Then
rprobDBConnect.Close
End If
' Setup remote connection parameters
ConnString = "DSN=MYSYB1; Uid=sa; Pwd=blah"
rprobDBConnect.CursorLocation = adUseServer
rprobDBConnect.Open ConnString
strSQL = "insert INTO prob IN 'c:probdb.mdb' select * FROM prob"
rprobDBConnect.Execute strSQL
End Sub
: Export Data From Access Table To SQL SERVER Table Programatically
Dear All,
I have a table in Access. I want to export the data from that table's fields into one field of SQL SERVER database table. for eaxmple.
Let I have a table named A in access. Table A has 5 fields. Also i have a table in SQL SQRVER.Let that table name is B. I want to export data from Access table A fileds into one field of SqlServer table B.
Can you help me plz.
RESOLVED!!! Help - Access Data From One Table And Saves It To Another Table
okay, here i am again...
i have information saved in Table1, now when i do editing or update with these data, i have to save these changes in Table2.
basing from previous codes and same interface i used with the payroll project (had combobox for the student id and upon clicking so, needed data will be displayed on the textbox controls)... here's what i did:
i put these two queries at the combo click event:
Code:
sql = "SELECT * FROM Table1 WHERE studeid =" & cmbid.Text & " "
If rsStudeData.State = 1 Then rsStudeData.Close
rsStudeData.Open sql, acadConnection, 1, 2
Call StudeData ' function for displaying data on the textboxes
Exit Sub
sql2 = "SELECT MAX(acadyear) As maxacad_year From Table2"
If rsAcad.State = 1 Then rsAcad.Close
rsAcad.Open sql2, acadConnection, adOpenDynamic, adLockOptimistic
txtacadyear.Text = rsAcad("maxacad_year") 'this textbox's visible property was set to false since it only serves as a container with my acadyear criteria in the update query
Exit Sub
End Sub
then in my update command, i created this update query... with two criteria (must update data bearing the specified student id and current year)
Code:sql1 = UPDATE Table2 SET field1 = '"& txtstude(0).Text & "', field2 = '" & txtstude(1).Text & "' field3 = '" & txtstude(2).Text & "', Field4= '" & txtstude(3).Text & "', field5='" & txtstude(4).Text & "', field6 = '" & txtstude(5).Text & "', field7='" & txtstude(6).Text & "' WHERE studeid = " & cmbid.Text & " AND acadyear = #" & Format(CDate(txtacadyear.Text), "yyyy") & "#"
acadConnection.Execute sql1
this however, had a prob with it... type mismatch - the debugger highlights whole sql
i suspect it has to be my query for the latest date, i tried setting the txtacadyear's property to visible and found out, no date is displayed - meaning my query for the latest academic year didn't work out???...
any idea? tnx...
everything started out from nothing... everyone started out knowing nothing...
Edited by - newbie2005 on 3/1/2005 9:18:08 PM
Insert Data Into MS Access 97
I want to insert value into ms access 97, how to do it? wat reference have to be added? my table name is LOGFILE pls help
Access Delay When Insert Data
hello
i have noticed that after i insert data into ms access using vba it takes a ~5 seconds delay to display the new data in controls like a listbox using a normal query,
i want to ask you if it is possible to make the data viewable insantly after the insert
i am not sure if that happens because of access or because some config i'm missing, so i wanted to ask
thanks for your advise
Insert Data Access Database
im very new to VB. I created vb forums that lookup data from a acess database...... But how would i inset data from a vb for into a access database... how owuld i start this and are their any examples???
Thanks
Insert Data From Excel To Access
I need to insert data from a Excel file to an Access table.
I refer to an old topic here pertaining to that same case and follow the code they'd present their.
Quote:
Dim Cn As ADODB.Connection
Set Cn = New ADODB.Connection
'lets connect to the workbook first, I tested this, it works for me
Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sample.xls;Extended Properties=Excel 8.0;" _
& "Persist Security Info=False"
' Append data from Sheet1 of workbook to Table1 of mydb.mdb:
Cn.Execute "INSERT INTO [Table1] IN 'db1.mdb' SELECT * FROM [Sheet1$]"
Cn.Close
Set Cn = Nothing
But I'm having an error like this...
Quote:
Could not use 'db1.mdb'; file already in use
Why is that?
Error Insert Data Into Access DB
Hi
When I run the code below sql I get this error:
Err
Description "syntax error in INSERT INTO statement"
HelpContext 5003134
HelpFile "C:WINDOWSHelpVBENLR98.CHM"
LastDllError 0
Number -2147217900
Source "Microsoft JET Database Engine
I am trying to insert Username and password into an access DB.
Please help me!!!!
Code:Private Sub cmdSave_Click()
Dim strSQLExist As String
If IsNull(txtUserName.Text) = False Then
strSQL = "SELECT * FROM tblUsers ORDER BY UserName"
strSQLExist = "SELECT * FROM tblUsers WHERE UserID = '" & txtUserName.Text & "'"
If objPizzaData.FindExistingID(txtUserName.Text, strSQLExist) = False Then
If txtUserName.Text = vbNullString Then
MsgBox "Please fill in the text fields correctly before saving."
Else
strSQLAdd = "INSERT INTO tblUsers (UserID, UserName, Password)" & _
" VALUES ('" & txtUserName.Text & "','" & dcUserName.Text & "'," & _
"'" & txtPassword.Text & "')"
objPizzaData.ExecuteSQL (strSQLAdd)
Call LoadCombo
Exit Sub
End If
End If
End If
cmdNew.Visible = True
cmdSave.Visible = False
cmdCancel.Visible = False
cmdDelete.Visible = True
txtPassword.Enabled = False
txtConfirm.Enabled = False
End Sub
Thanks
Edited by - Tysta on 5/14/2003 4:15:06 AM
Insert Data Into Access Using Combobox And List Box
rs.Open "INSERT INTO BookReturnTable(Book-ID, Student-ID, ReturnDate, Status, Fine, AmountPaid)Values ('" & TxtBookId1 & "', '" & Text1 & "', '" & Text2 & "' , '" & x & "', '" & TxtTitle & "', '" & TxtAuthor & "')", cn
I'm using such statement to insert the data but no idea in inserting the data using list box and combo box...Need some guidance as well as some example...Thank you
Bulk Insert Of Data Into An Online Access Db
Using ASP, is there a way to bulk insert data into an online access db?
Here's the scenario--a salesman enters contact info into his laptop in his truck throughout the day. At the end of the day, I want him to be able to log onto his company website and upload all of the records into an online access db.
Doable?
Using SQL INSERT To Place New Data In An ACCESS DATABASE
Could someone please take a look at my program and help! me
I want to write into the database with either the combo boxes or text boxes.... but how do i do it when the database has relasions??.... and with one button....
this is the button code so far...
Private Sub indskriv_Click()
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim titel As String
Dim sprog As String
Dim år As String
Dim selskab As String
Dim skuespiller As String
Dim instr As String
data = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=film.mdb;Persist Security Info=False"
con.Open (data)
Sql = "insert into film (titel) values ('" & titel_ind.Text & "')"
con.Execute Sql
Sql = "SELECT * FROM film WHERE titel = ('" & titel_ind.Text & "')"
rs.Open Sql, con, adOpenDynamic
titel = rs("filmid")
rs.Close
Sql = "insert into selskab (navn) values ('" & selsk_ind.Text & "')"
con.Execute Sql
Sql = "SELECT * FROM selskab WHERE navn = ('" & selsk_ind.Text & "')"
rs.Open Sql, con, adOpenDynamic
selskab = rs("id")
'skuespiller = "insert into skuespiller (fornavn, efternavn) values ('" & rolle_for.Text & "','" & rolle_ef.Text & "')"
'con.Execute skuespiller
'tsu = "insert into Film (Titel, Sprog, Udgivelsesår, selskab) values ('" & titel_ind.Text & "','" & sprog_ind.Text & "','" & år_ind.Text & "','" & selskab & "')"
'con.Execute tsu
titel_ind.Text = ""
sprog_ind.Text = ""
år_ind.Text = ""
selsk_ind.Text = ""
MsgBox "du har tilføjet dit indtastede data"
End Sub
the code is not at all finished.... but i would be glad if someone could help me?.... so DL the "program" and take a peek if you want
it is in danish..... so the button you are looking for is "indskriv".... under "indskriv en film"
Copying Data From EXCEL To Access Using INSERT INTO Is This Possible
I have created a ADO connection to an excel file by the following
**************************
Dim xlsConn1 As string
Dim xls_conn As ADOB.connection
Dim xls_rs As DOB.Recordset
xlsConn1 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Source=C: est.xls; Extended Properties = ""Excel 8.0;" & _
"HDR=YES""""
Set xls_conn = New ADODB.Connection
Set xls_rs = New ADODB.Recordset
xls_conn.Open (xlsConn1)
xls_rs.Open "Select * from [test$A21:T75]', xls_conn
**************************
I would like to take the data range test$A21:T75 and insert it into anaccess database. This is what I'm tying to do, but I'm having problems with the "...Insert Into..." syntax.
Here is the code that I'm using
**************************
Dim acsConn1 As String
Dim acs_conn As ADOB.Connection
Dim acs_rs As ADOB.Recordset
Set acs_conn = New ADODB.Connection
Set acs_rs = New ADODB.Recordset
ascConn1 = "Provider=....
acs_conn.Open (ascConn1)
## The Following is the code syntax that I'm having trouble with. I would like to use the "Insert Into" to copy data from EXCEL into Acess. I was hoping I could use the following statement to do this, but I'm having issues:
acs_rs.open "INSERT INTO JessTest Select * FROM [test$A21:T75],acs_conn
where, JessTest is the table that I want to insert the data into
Does anyone have any suggestions? From the errors I'm receiving, it appears that you can only insert data from a table that exsists in data base that you are connected to. In this case with would be acs_conn. Is this true?
Insert Data To MS Access Database From Forms!
Hi Guys.
I am just wondering how I insert data from my window with the textboxes and everything to my table in my Access database.
Also, I have the customerID number on my form and in the database it is an autonumber. How do i show the customers actual customerID when the form window opens?
Cheers and thanks in advance.
Insert Data To Access With Visual Basic
Hello guys,
I would like to ask you if you can help me. I have a database wich take tha data with visual basic 6. I want to save tha data (textboxes) into the database. The name of the database is mydb and include the lname,fname and address.
Thanks in advance.
Insert,delete,update Data To Access Db In Lan Environment
i always got an error message "Operation must use an updateable query" whenever i tried to add,delete,update,edit data to my access database which was located in our local server.im making a vb application as front end and soon i will install it in 5 workstations and my access database as my back end is located in the server.i have this error "Operation must use an updateable query" whenever i tried to add data to the database.
how can i solve this problem?is there any simple solution regarding this?
your soonest reply would be very much appreciated
thanks and good day!!
|