change the color for DBGrid row; Input Validation code help!!
I am at the ending part of coding for a Library software but I am unable to move forward as I can’t figure out the way to change the color for DBGrid row. I am using MsAccess as the database. I want the color of a particular grid row to change its color to say Color. Red through coding that is. Actually this is to be executed after lapse of a particular date. There can be N number of rows, but I want only that particular row whose date has crossed the dateline turn to red(background color or show a message for that row). Also I am doing input validation check, what would be the best way for this..? I badly need technical support again. I hope I am not asking too much. Would really appreciate any kind of suggestion. Thanks.
Code for input validation. I get this error message Run time error ‘13’: Type mismatch. And even if the warning message is shown the details are already added to the data base and all text box cleared.
Data1.RecordSource = "select * from Book_Details"
Data1.Refresh
Data1.Recordset.AddNew
If Val(Text1.Text) <> "" Then ‘Works without input validations.
Data1.Recordset.Fields(0) = Text1.Text
If Val(Text2.Text) <> "" Then
Data1.Recordset.Fields(1) = Text2.Text
Else
MsgBox "Please enter the Book Name.", vbOKOnly, "BookName"
End If
Else
MsgBox "Please enter the Acc No", vbOKOnly, "Acc No"
End If
Data1.Recordset.Update
Data1.Recordset.Close
Text1.Text = ""
Text2.Text = ""
chanthung
Junior Poster in Training
52 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
Mighty thanks for the elaborate explanation given and the much needed code. Also the input validation code will really help as I was struggling with it. But I was wondering if there is any way to let the user know when the deadline is crossed, say through message box(datas which are displayed through Grid layout). And if it can be done, how?
chanthung
Junior Poster in Training
52 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0