Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #41 (permalink)  
Old July 28th, 2005, 04:39 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #42 (permalink)  
Old July 28th, 2005, 05:44 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #43 (permalink)  
Old July 28th, 2005, 08:14 PM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Raghavendra Mudugal,

I've seen the example and shall take some time to learn it well.
Thank You so much =)

Astro

Reply With Quote
  #44 (permalink)  
Old July 29th, 2005, 02:24 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #45 (permalink)  
Old July 29th, 2005, 02:40 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #46 (permalink)  
Old July 29th, 2005, 03:05 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #47 (permalink)  
Old July 29th, 2005, 03:15 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #48 (permalink)  
Old July 31st, 2005, 10:30 PM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #49 (permalink)  
Old August 1st, 2005, 01:55 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #50 (permalink)  
Old August 1st, 2005, 02:08 AM
Registered User
 
Join Date: Aug 2005
Location: , , Senegal.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update query: Editing phone number fields? monacle Access 2 February 27th, 2007 08:55 AM
Combining Text Fields lizhaskin Access VBA 1 May 1st, 2006 06:15 AM
Calculating text fields jayman Classic ASP Basics 13 March 6th, 2006 05:27 AM
MySQL Text Fields MAtkins General .NET 0 May 27th, 2005 03:17 PM
variable number of fields in record manisha.anand Oracle 0 July 1st, 2004 05:00 PM



All times are GMT -4. The time now is 01:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.