Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 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
Old July 20th, 2013, 09:01 AM
Registered User
Join Date: Jul 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP-Grid Control Help Need to verify date format and update database record

Hello All,

I have a VB6 Form that has a Grid control. The Grid has 10 columns. The number of rows that get built are dynamically built based upon the number records I pull back from a database call that pulls records back from my query call to the database.

From below you will see that I do not have a lock on my Start Date column. I need to be able to allow a user to manually change the Start Date column verify that it's a valid date time. Right now the initial value for date time cell after my database call is a string in the form of MM/DD/YYYY HH:MM:SS. I would appreciate any help. I was thinking the simplest way to handle this is to have some type of event fire off when a person changes the mouse clicks on/off any cell in the targeted column that needs to get checked as a valid date time.

Second thing I need to do have a way capture the user changed date and update the appropriate record back in the database. Please help as I have been charged to handle this requirement. I haven't touched VB6 in years but I have been charged with making changes to a legacy application. Below is how I'm originally populating my columns and dynamically building my rows in my Grid Control.

Here is a sample of how I'm initially building my Grid .

With shtJobEditDate 'Name of Grid Control

Do Until rsMach.EOF 'rsMach is name of the ADODB.RecordSet

.MaxRows = .MaxRows + 1
.Row = .MaxRows
'.Col = GridCols.KeyCol 'GridCols is an enumeration of column order
'.Text = rsMach!ljtScanKey
.Col = GridCols.CstCtrCol
.Lock = True
.Text = rsMach!ljtCostCenterCd


.Col = GridCols.StartDTCol
.Text = rsMach!ljtStartTime

I've added a Save Button to my form. And in my btnSave_Click() event I'm trying to use the IsDate function to validate if any entry from any row in my column position 9 is a valid date time format. I've tried the following code but get a runtime error. The Grid control is of a Far Point spSpread control.

IsDate (shtJobEditDate.ActiveCol(9).CellValue(shtJobEditD ate.ActiveSheet))

The compiler states "Invalid qualifier"

Last edited by 2peeps2; July 20th, 2013 at 10:47 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
retrieve date with format (M Y) form database php Mahmoud82 PHP How-To 2 November 30th, 2006 07:10 AM
Verify Database giving object reference error cgiuda Crystal Reports 0 May 10th, 2006 07:50 AM
Date format in ASP and in SQL 2000 Database phungleon Classic ASP Databases 1 December 23rd, 2004 12:57 AM

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