try the simple code
con.begintrans 'con-----adodb connection object.
con.execute "your DML statement here"
con.committrans
try the simple code
con.begintrans 'con-----adodb connection object.
con.execute "your DML statement here"
con.committrans
try to use
SAVESETTINGS
GETSETTINGS
DELETE SETTINGS
for the purpose.
you must be connected to the database.
what is the query that you are working on ?
where is the code to modify.
the code only includes a select statement.
if you are using oracle as database then can use external table for the best solution,but you need to extract the zip first.
you need to parse the value before passing the same into database.
the code is straight forward but i am afraid that is not the complete code and has some dependency with other parts of the code
do you want to do all that from VB 6.0 ?
"Love is as much of an object as an obsession, everybody wants it everybody seeks it, but few ever achieve it, those who do, will cherish it, be lost in it, and among all, will never...never forget it."
"Romance is the fuel that keeps love burning hot." ------ Rusty Silvey
you need to increase field size of office_adress and other text fields.
try using the following
Public Sub runOmitVendorQuery()
SQLomitVendor = "select UserRights from tblUSERS where UserID = " & CurrentDeviceUserID
Set rsOmitVendor = New ADODB.Recordset
rsOmitVendor.Open SQLomitVendor, cnConnection, adOpenDynamic
End Sub
you need to use proper variable type and modify the fields in database table to accomodate data that you are going to pass from application.
ensure that you are passing a number for number field with out any special characters
you are getting 0 means there is something wrong with the input string through textbox or any other control
use the following
SQL = "INSERT INTO Supplier(Supplier_ID, Supplier_name,Fax_No,Contact_person,Contact_No,Supp_Type,Office_Address,Emails,website) values(" & val(Combo1.Text) & ",'" & Text1.Text & "'," & val(Text2.Text) & ",'" & Text3.Text & "'," & val(Text4.Text) & ",'" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "')"
ensure to pass number value only (not text) for the fields
Supplier_ID
Fax_No
Contact_No
use val(te3xtboxname)
check the query that is being framed at run time and try to run the same from backend directly.
that simply means you need to pass data of proper type to insert statement.
how you decide if the user is an admin user or not ?
what is the logic for that ?
is there is corresponding field for that value as well ?
you need to open the recordset as per selection of the combobox input and pass the same recordset to report.
recheck your code
rename the type field to something else more meaningful.
pass the value in proper format as per database field type.
"What is done out of love always takes place beyond good and evil".
----Friedrich Nietzsche
help how can i know if the user is not an admin
i have combo box in my combo box have a user or admin additem if he choose admin then all i want is to validate if the username and password is for admin user this is my code
please post clearly using correct english and grammer.
simple crate the table2 and run the following
insert into table1 select * from table1
use the following code
con.BeginTrans
SQL = "INSERT INTO Supplier(Supplier_id,Supplier_name,Fax_no,Contact_person,Contact_no,Type,Office_address,emails,website) values('" & Combo1.Text & "',' " & Text1.Text & "','" & Text2.Text & " ',' " & Text3.Text & " ','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "')"
con.Execute SQL
con.CommitTrans
why you are passing 10 values for 9 field s ???
you only want to take back up of the table or want the transaction to be affected in both the tables.
if u want only back up then simply copy the table or the entire database file.
avoid using ' (single quote) while passing values from textbox.
post the sql insert statment that you are getting.
check my previous post and correct accordingly
before executing the sql , check the same using msgbox.
try this
Private Sub Command2_Click()
If (CheckInput) Then
End If
Y = MsgBox("do you add this record", vbYesNo + vbQuestion, "message")
If Y = vbYes Then
Set con = New ADODB.Connection
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\asfserver\itp$\product_tabletest.mdb"
con.BeginTrans
SQL = "INSERT INTO Supplier(Supplier_id,Supplier_name,Fax_no,Contact_person,Contact_no,Type,Office_address,emails,website) values(" & Text1.Text & ",'" & Text2.Text & "'," & Text3.Text & ",'" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text & "')"
con.Execute SQL
con.CommitTrans
End If
End Sub
Ensure to pass text into text field and number into number field. extract number from textbox and pass to query after converting to number. else you might have to make some changes in the insert statement.
try the following sample
dim sqlstmt as string
sqlstmt = "INSERT INTO Supplier(Supplier_id,Supplier_name,Fax_no,Contact_person,Contact_no,Typ,Office_address,emails,website) values(" & text1.text & ",'" & text2.text & "'," & text3.text & ",'" & text4.text & "','" & text5.text & "','" & text6.text & "','" & text7.text & "','" & text8.text & "','" & text9.text & "')"
con.Execute sqlstmt
also better change the field name Type to something more meaning ful, becuase that is a keyword.
you need to frame the insert statmnet dynamicaly by passing values
you can use loop inside a sub program for the purpose.
what is the database that you are using ?
1) FRM-----form file contains all the componenets and code there of.
2) BAS-----module file contains objects with global access
3) FRX-----form binary file contains images of FRM file.
4) OCX----windows components.
5) CLS----class file contains the classes defined if any.
6) VBP-----visual basic project.
hope that helped you.
why you have passed all those ???? marks in place of values, while not using any parameters.
values you need to capture from textboxes and those need to be properly formatted before passing to database.
do not expect us to guess and solve your problem.
Please post the structure of your tables.
are you trying to prepare the insert script for all the tables ?
Why you need all the lengthy code
just try this
con.begintrans 'con---ADODB connection object.
con.execute "your insert statment here"
con.committrans
try the following
dim con as new adodb.connection
con.open "your connection string here"
add my previous code after this line
better use ADODB library for the purpose. try the sample code below
con.begintrans 'con-----adodb connection object
con.execute "your sql insert statment here"
con.committrans
1.take backup of the table.
2.create new table with vertical model
3.then you need to remap the old data to new model
in this step you will face some diffucilty.
I will try to post some easy solutions for you later on.
are you trying to convert the horizontal model to horizontal ?
try the following code with ADO
con.begintrans 'con--ADODB connection object
con.execute "put your sql statement here "
con.commitrans
better to use some expression that will evalute to boolean.
the previous post is a better example of the same.
"Upon thy cheek I lay this zealous kiss, as seal to the indenture of my love"
William Shakespeare in King John, Act ii, Sc.1