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 Databases Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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
  #1 (permalink)  
Old February 10th, 2007, 07:21 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default HOW CAN SYSTEM DATE N TIME BE CAPTURED IN A TXTBOX


Dear Member,

     I am having a form, in which I have three fields Customer Number, Date n Time. I want the System date and time to be written in these textboxes.How can I do it? Ie, When a complaint arrives the Complaint Number should be automatically shown, and also the Date n time shown the system date n Time.



       Nanda Kumar


Reply With Quote
  #2 (permalink)  
Old February 10th, 2007, 08:36 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In Vb2005

' Displays the date
Me.TextBox1.Text = DateTime.Now.ToShortDateString

' Displays the time
me.textbox1.text = datetime.now.ToShortTimeString


Reply With Quote
  #3 (permalink)  
Old February 12th, 2007, 02:04 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default

Quote:
quote:Originally posted by HaveHave2222
 In Vb2005

' Displays the date
Me.TextBox1.Text = DateTime.Now.ToShortDateString

' Displays the time
me.textbox1.text = datetime.now.ToShortTimeString


Thanks 4 ur reply.I tried it. but, not functioning properly. I changed the name of the textbox to txtDate and txtTime.

Me.txtDate.text = DateTime.Now.ToShortDateString

Me.txtTime.Text = DateTime.Now.ToShortTimeString. Is this statement correct?


I have another doubt. How can we connect Access and VB form.Should we use SQL Statements (Thru ODBC Conneection).

And also, How can we capture datas written to Acess DB be taken to a separate form. (For Eg. I have a Customer Complaint Form.When a customer enters any complaint about a product,the Complaint details should be entered in the form (like what we do when we click on a Button for Feedback Form, the feedback details directly goes to the Email id of the Concerned Person).There I have another field, along with Customer Name, Area of Complaint, complaint Details, Telephone, Email Id etc, Select technician (When the complaint is received at the concerned HelpDesk, it should be directly assigned to a technician. when we select the technician, the name of the technician should also be entered into the database.I am using VB 6.0.
Reply With Quote
  #4 (permalink)  
Old February 12th, 2007, 11:19 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On the date part:

In VB6 you just use "Now". You can format it as you please, but the simplest thing is:

Me.txtDate.Text = Now

Woody Z
http://www.learntoprogramnow.com
Reply With Quote
  #5 (permalink)  
Old February 13th, 2007, 06:22 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default

Thanks a lot...
Another doubt I am having is that I have created a DB with ADODC and in the VB Form properties (ADODC) I have connected the DB with the VB Form. But When I try to enter some values in the Text box and when I go to next field, the earlier value (for example, the first field name is Name of Customer).I entered the value for the field.and when I try to enter the value for the next field, the first value disappears. Is it because of the ADODC connection.

   How can I connect VB form and DB with SQL (INSERT) Command.The fields I am having are Name of the Customer,dept / Area, Area of compalint, Complaint details,Telephone and E-mail Id.

Can you please help me in these...........

Nsnda Kumar

Quote:
quote:Originally posted by woodyz
 On the date part:

In VB6 you just use "Now". You can format it as you please, but the simplest thing is:

Me.txtDate.Text = Now

Woody Z
http://www.learntoprogramnow.com
Reply With Quote
  #6 (permalink)  
Old February 13th, 2007, 11:08 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah. Good old databound controls.

I must say - the mechanism of databinding in VB6 isn't worth using. Whenever I have consulted on a project where part of the design included using databound controls I would insist that they be removed and everything done in a more sane manner.

If you are stuck with having to use the data control and databound controls - I sympathize.

You can't connect with an insert command - only a select command. However, all the controls should be editable and you should be able to post your data back to the database. I am not the right person to troubleshoot this since it has been over 7 years since I last had to deal with datacontrols and databound controls.

Woody Z
http://www.learntoprogramnow.com
Reply With Quote
  #7 (permalink)  
Old February 14th, 2007, 02:09 AM
Authorized User
 
Join Date: Jan 2007
Location: TRIVANDRUM, KERALA, India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cnkumar74 Send a message via Yahoo to cnkumar74
Default


thanks a lot


     nanda kumar



Quote:
quote:Originally posted by woodyz
 Ah. Good old databound controls.

I must say - the mechanism of databinding in VB6 isn't worth using. Whenever I have consulted on a project where part of the design included using databound controls I would insist that they be removed and everything done in a more sane manner.

If you are stuck with having to use the data control and databound controls - I sympathize.

You can't connect with an insert command - only a select command. However, all the controls should be editable and you should be able to post your data back to the database. I am not the right person to troubleshoot this since it has been over 7 years since I last had to deal with datacontrols and databound controls.

Woody Z
http://www.learntoprogramnow.com
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
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
captured groups with replace() igraham XSLT 3 September 4th, 2007 12:43 PM
How can I set system time & date in VB.net ? mike123abc Pro VB.NET 2002/2003 1 April 27th, 2007 10:00 AM
Insert System date and System Time -Form _TextBox cnkumar74 VB How-To 14 February 14th, 2007 10:52 AM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM



All times are GMT -4. The time now is 12:53 AM.


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