 |
| VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 28th, 2005, 04:39 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Raghavendra Mudugal
I've seen the example that you have uploaded, played around with it for practice and that helped me to pick up some new stuff.
In this case, i assume that Recordset is what i need to add, update and edit data in the tables?
Say if i were to save strings from the text-field, i will have to use Recordset as well? if it is possible could you show me an example on that? Sorry to trouble you, i've been trying to figure out on that one.
Thank You
Astro
|
|

July 28th, 2005, 05:44 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Astro
Check this link
http://in.geocities.com/raghavendra_...l/db_ado02.zip
I have written the code for inserting and updating the data
using recordset.
Check this out and let me know
Hope this helps
With Regards,
Raghavendra Mudugal
|
|

July 28th, 2005, 08:14 PM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Raghavendra Mudugal,
I've seen the example and shall take some time to learn it well.
Thank You so much =)
Astro
|
|

July 29th, 2005, 02:24 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Raghavendra Mudugal
I am progressing pretty much with your example!
There is a question on Access table's autonumber format, because the example you have uploaded handles cid (from table: cust)with Value (e.g 1, 2, 3).
I would like to prefix my ID with e.g qns0001, qns0002 and so on, is Access able to perform that?
If so, could you advice me on how to edit the VBA codes in order command9_click() to handle String instead of Value. I read something about Cstr() but don't know if it is right to make use of that.
This is getting interesting =) Thank You!
Astro
|
|

July 29th, 2005, 02:40 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Astro
Check this link
http://in.geocities.com/raghavendra_...l/db_ado03.zip
I have changed the code that it stores the way you want it
as string. Look to this example, it has another table that
keeps track on the serial number. It is the best way to
use for inserting the new record and for optimization.
you will get it faster.
check this out and let me know.
Hope this helps.
With Regards,
Raghavendra Mudugal
|
|

July 29th, 2005, 03:05 AM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Raghavendra Mudugal,
Managed to spot the difference (rst!cid = "qns" & Right("0000" & CStr(CInt(rst1!cid) + 1), 4))
this one looks eally high level! haha.
Thanks man, will keep you updated!
Astro
|
|

July 29th, 2005, 03:15 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Astro
Its very simple,
qns is the word you want to attach to the string and
rest Right("0000" & CStr(CInt(rst1!cid) + 1), 4)) is simple
Right("0000" & CStr(CInt(rst1!cid) + 1), 4))
(four (incressing the cid by 1
zeros and converting whole thing
after to cstr (sring) and that 4
qns indicates the length to supress
the string, 1 -> 0001 and for
100-> 0100, like this.
It is simple.
Hope this helps.
With Regards,
Raghavendra Mudugal
|
|

July 31st, 2005, 10:30 PM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Raghavendra Mudugal
Haha yea it looks much simpler after you explained!
Is it right to say that handling more than one table requires a seperate recordset each?
Thank You!
Astro
|
|

August 1st, 2005, 01:55 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Astro
It depends. and most of all it is the good way to use one recordest
and executing the data what we want using a single SQL statement
using JOINS for more than one table(s).
And there is another object for handling the data inserting and updating
that is ADODB's COMMAND OBJECT. It is used for executing the SQL statements
in optimised manner. Here it opens the connection and executes for the rest.
and it does not keeps the connection with the database alive as recordset
does (until and unless you finish the work the recordset is open and depen-
dent tables are locked for time being).
YOu will explore these things later.
Hope this helps
With Regards,
Raghavendra Mudugal
|
|

August 1st, 2005, 02:08 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Raghavendra Mudugal, i have look at the code u submit for the db_ado3.zip. I was quite new to VBA and will like to how how to save the cName to the cust table and another table name custbackup. how should i do it so i can save it to both table and update together. Sorry to trouble u.. thank alot.
|
|
 |