473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Query Tools

Hi...im doing a query tools using vb6 that runs a query in access, How can i do so....im confused...plz guide me....
Apr 24 '08 #1
32 2538
debasisdas
8,127 Expert 4TB
You just need to frame the query properly and execute that using ADO objects.
Apr 24 '08 #2
Im not understand..plzzzzzz guide..i'll thank 4 u
Apr 24 '08 #3
debasisdas
8,127 Expert 4TB
Do you know how to execute a query in VB ?
Apr 24 '08 #4
I had do the query n it was success . Thank u.Now i face difficulities in trim character from a coloumn like 101-001 to 101001. It can do by run a query in access directly but in vb6 i cant...

UPDATE Alternator
SET EversparkNo1 = REPLACE(EversparkNo1, '-', '')

this 1 i do in access query directly
Apr 25 '08 #5
jamesd0142
469 256MB
I had do the query n it was success . Thank u.Now i face difficulities in trim character from a coloumn like 101-001 to 101001. It can do by run a query in access directly but in vb6 i cant...

UPDATE Alternator
SET EversparkNo1 = REPLACE(EversparkNo1, '-', '')

this 1 i do in access query directly

You can run this query through vb also, you ned to execute a non query...
Apr 25 '08 #6
what is non query? Plzzzzz give me some examples...urgent..thanks
Apr 28 '08 #7
debasisdas
8,127 Expert 4TB
You can run this query through vb also, you ned to execute a non query...
What is a non query in vb 6.0 ???
Apr 28 '08 #8
Do anyone can help me in solve this problem. I need to update my column using query.
Apr 28 '08 #9
jamesd0142
469 256MB
What is a non query in vb 6.0 ???
Does vb6 not have something simular to this debasisdas?, I use vb2005 and code such as:

Expand|Select|Wrap|Line Numbers
  1. imports system.data.oledb
  2.  
  3.                 Dim oConn As New System.Data.OleDb.OleDbConnection(StrConn)
  4.                 oConn.Close()
  5.                 Dim con As New System.Data.OleDb.OleDbCommand
  6.                 con.Connection = oConn
  7.                 con.CommandType = CommandType.Text
  8.                 con.CommandText = "Insert Statement"
  9.                 oConn.Open()
  10.                 con.ExecuteNonQuery()
  11.  
Surely you can do something like this in vb6, right...?
Apr 28 '08 #10
debasisdas
8,127 Expert 4TB
There is nothing like non query in VB 6.0.

If you do not know the answer in the version that is clearly mentioned by the OP in the question, no need to post what you think is correct in higher version.

No need to post .NET replies to VB 6.0 questions.

Limit those to .NET forums only.
Apr 28 '08 #11
Mine is vb6 platform. Plz do help me in correct query to update my field. Plsssssssss i still finding 4 the answer......
Apr 29 '08 #12
debasisdas
8,127 Expert 4TB
try to use like this

Expand|Select|Wrap|Line Numbers
  1. con.BeginTrans                     'con is the ADODB connection object
  2. con.Execute "your sql query here"
  3. con.CommitTrans
  4.  
Apr 29 '08 #13
Type mismatch error occur.Pls help me edit my coding down here.I need it urgently. Thanks in advance.....plzzzzzzzzz help me.


db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "Everspark2.mdb"

' Open a connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
conn.Open

conn.BeginTrans
conn.Execute "UPDATE Alternator SET EversparkNo1 = REPLACE(EversparkNo1, " - ", "")"
conn.CommitTrans
Apr 29 '08 #14
undefine function 'REPLACE' in expression error also occur.
Apr 29 '08 #15
No body can help me???????????????plzzzzzzzzzzzz
Apr 30 '08 #16
debasisdas
8,127 Expert 4TB
try this

Expand|Select|Wrap|Line Numbers
  1. conn.BeginTrans 
  2. conn.Execute "UPDATE Alternator SET EversparkNo1 = " & REPLACE(EversparkNo1, " - ", "")
  3. conn.CommitTrans
  4.  
Apr 30 '08 #17
conn.BeginTrans
conn.Execute "UPDATE Alternator SET EversparkNo1 = " & Replace(EversparkNo1, " - ", "")
conn.CommitTrans

EversparkNo1 that i bold was not define eror....is it a variable? EversparkNo1 is a field in table. How to solve it. Plzzzzzzzz.....
May 2 '08 #18
debasisdas
8,127 Expert 4TB
if that is a field then what is the meaning of your update statment ?
May 2 '08 #19
i have one field which is Eversparkno1 where all its data got ' - ' now i want to remove the ' - ' to ' ' nothing, that means if 101-001 i want to change to 101001. so i want to do it by query, this replace successful if run directly in access but..now im doing in vb as a tools for query.
May 2 '08 #20
debasisdas
8,127 Expert 4TB
try to use this

Expand|Select|Wrap|Line Numbers
  1. conn.BeginTrans
  2. conn.Execute "UPDATE Alternator SET EversparkNo1 = select Replace(EversparkNo1, " - ", "") from Alternator
  3. conn.CommitTrans
  4.  
NOTE :-- Check for the quotes ' and "
May 2 '08 #21
Type dismatch error occur....plssssssss help me...next week i must present to my boss....

db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "Everspark2.mdb"

' Open a connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
conn.Open

conn.BeginTrans
conn.Execute "UPDATE Alternator SET EversparkNo1 = SELECT REPLACE(EversparkNo1, " - ", "") FROM Alternator"
conn.CommitTrans
May 3 '08 #22
Anyone can help me?????? Plssssssss
May 5 '08 #23
debasisdas
8,127 Expert 4TB
Type dismatch error occur....
which line causes the error ?
May 5 '08 #24
conn.Execute "UPDATE Alternator SET EversparkNo1 = SELECT REPLACE(EversparkNo1, " - ", "") FROM Alternator"

this line got error
May 6 '08 #25
debasisdas
8,127 Expert 4TB
run the query directly in database and check if that works .
May 6 '08 #26
No, the query shows error. This query down here is success.....

UPDATE Alternator SET EversparkNo1 = REPLACE(EversparkNo1, " - ", " ")
May 7 '08 #27
why no one response to my question? plz help me ......i try a lot of way..but all error....
May 9 '08 #28
QVeen72
1,445 Expert 1GB
Hi,

Try This :

Expand|Select|Wrap|Line Numbers
  1. conn.Execute "UPDATE Alternator SET EversparkNo1 = REPLACE(EversparkNo1, ' -', '') "
  2.  

Regards
Veena
May 9 '08 #29
I had try..but Undefine function "REPLACE" in expression error occur. Please Help me.
May 13 '08 #30
I had try..but Undefine function "REPLACE" in expression error occur. Please Help me.

Hi Friend.

Please make sure that whether You have selected latest library or not regarding (DAO or ADO) so that library should support this function.

Please make sure that which version you are using.


Regards
Musai.
May 13 '08 #31
QVeen72
1,445 Expert 1GB
Hi,

Yes, "REPLACE" Function will not work with ADO,

Use a Combination of Left and MID and INSTR Functions..

Try This :

Expand|Select|Wrap|Line Numbers
  1. conn.Execute "UPDATE Alternator SET " _
  2. & " EversparkNo1 = Left(EversparkNo1,Val(InStr(EversparkNo1,'-')-1))  " _
  3. & " Mid(EversparkNo1,Val(InStr(EversparkNo1,'-')+1))  " _
  4. & " Where EversparkNo1 Like '%-%' "
  5.  

Note: Only First Found "-" is replaced.
If you have multiple occurance of the same character,
say 3 times , then you need to run the same query thrice...

Regards
Veena
May 13 '08 #32
QVeen72
1,445 Expert 1GB
Hi,

Sorry, "&" was removed.. Try this one:

Expand|Select|Wrap|Line Numbers
  1. conn.Execute "UPDATE Alternator SET " _
  2.   & " EversparkNo1 = Left(EversparkNo1,Val(InStr(EversparkNo1,'-')-1))  " _
  3.   & " & Mid(EversparkNo1,Val(InStr(EversparkNo1,'-')+1))  " _
  4.   & " Where EversparkNo1 Like '%-%' "
  5.  
Regards
Veena
May 13 '08 #33

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
1
by: Not4u | last post by:
Hello I have a SQL 2000 server, the server setting is default language : French and all Collation names in French If i launch the 'Query Analyzer' from the SQL Entreprise Manager on my...
3
by: Matt | last post by:
If I open Enterprise Manager through a saved MSC file, the Tools > SQL Query Analyzer option is greyed out (unavailable). If I open Enterprise Manager from the Programs menu, Query Analyzer is...
3
by: Eagle | last post by:
Hi all, This one's drivin' me nuts. Any help would be appreciated. (Access 2000). I have 3 tables: tblTools: having the basic data of a tool and a field (txt) showing yes or no with regard to...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
0
by: Dave | last post by:
Using Enterprise Manager's toolbar - Tools / SQL Query Analyzer gives me: "The specified file was not found". Same thing happens for Tools / SQL Profiler. But the apps will start just fine if I...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
12
by: zwasdl | last post by:
Hi, I'm using MS Access to query against Oracle DB via ODBC. Is it possible to use HINT in Access? Thanks, Wei
1
by: polyya | last post by:
Hi All, I'm working in Access 2000. Sorry for the long post, I'm trying to be as clear as possible. I've created junction tables to express M:M relationships for contractors and job task. ...
3
by: mnjkahn via AccessMonster.com | last post by:
I'm running Access 2003, modifying a query that has over 45 fields. When I right click on the field name in Query Design View, and then click Build, Access crashes before the Build window...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.