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..
|