Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & App.Path & "\db1.mdb;Persist Security Info=False;Jet OLEDB:Database Password=pwd;"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Table1 ", cn, adOpenForwardOnly, adLockReadOnly
While Not rs.EOF
if left(rs.fields("from_bus_id"),4)="S001" then ' ~~~> please try to use table/field names without spaces or you can use underscore
rs.fields("phasing")="CN" ' ~~~> new phasing
rs.update
end if
rs.MoveNext
Wend
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
You have to make some changes to the code.. like the database name , database password , etc... in the above code
Good luck...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
1 more sir, in this code..."If Left(rs.fields("From_Bus_ID"), 4) = "S003" Then"
what if im using 5 or 6 characters example: s0010 or s00100... ca n you please help sir/
anyway, is there possible to use input in textbox instead of coding in program in runtime? like in my previous post...
1 more sir, in this code..."If Left(rs.fields("From_Bus_ID"), 4) = "S003" Then"
what if im using 5 or 6 characters example: s0010 or s00100... ca n you please help sir/
anyway, is there possible to use input in textbox instead of coding in program in runtime? like in my previous SS post...
S003-TPD0005
We can extract the data before - using the below code....
Also, i used txtPhase, which is a text box that contains the old phase...
Code:
if left(rs.fields("from_bus_id"),instr(1,rs.fields("from_bus_id"),"-")-1)=txtPhase.Text then
Last edited by akhileshbc; Nov 13th, 2009 at 01:05 AM.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & App.Path & "\db1.mdb;Persist Security Info=False;Jet OLEDB:Database Password=pwd;"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Table1 ", cn, adOpenForwardOnly, adLockReadOnly
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While Not rs.EOF '~~~ loops through the recordset
if left(rs.fields("from_bus_id"),instr(1,rs.fields("from_bus_id"),"-")-1)=txtSearch.Text then
rs.fields("phasing")=txtNewPhase.Text ' ~~~> new phasing
rs.update
end if
rs.MoveNext
Wend
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
txtSearch is the text box which can be used to enter data like S003 txtNewPhase is the text box which can be used to enter new phase like CN
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
problem solved sir! it works perfectly...
thanks sir!
good day and GOD bless....
Happy to hear that...
You can mark this thread as RESOLVED
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India