texasgulfcoast
Member
- Joined
- Oct 10, 2005
- Messages
- 7
- Programming Experience
- Beginner
I want to make sure that when adding a new record to the Access DB the user enters data all fields. I figured out the Integer fields but cannot find how to check the String fields. I searched the forum and could not locate anything. Any help would be appreciated. The Description field is the one I need.
VB.NET:
[FONT=Courier New][COLOR=green]' Validate input when the contents of the column changes.[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] dtNames_ColumnChanging([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.Data.DataColumnChangeEventArgs) [COLOR=blue]Handles[/COLOR] dtNames.ColumnChanging[/FONT]
[FONT=Courier New] [COLOR=blue]Select[/COLOR] [COLOR=blue]Case[/COLOR] e.Column.ColumnName[/FONT]
[FONT=Courier New] [COLOR=blue]Case[/COLOR] "fldPartNumber"[/FONT]
[FONT=Courier New] [COLOR=blue]If[/COLOR] [COLOR=blue]Not[/COLOR] IsNumeric(e.ProposedValue) [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New] MessageBox.Show("Part Number must be numeric", _[/FONT]
[FONT=Courier New] "Error", MessageBoxButtons.OK)[/FONT]
[FONT=Courier New] [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New] [COLOR=blue]Case[/COLOR] "fldPartDescription"[/FONT]
[FONT=Courier New] [COLOR=blue]If[/COLOR] "fldPartDescription.ProposedValue.ToString() = "" Then[/FONT]
[FONT=Courier New] MessageBox.Show("Part Description must be entered", _[/FONT]
[FONT=Courier New] "Error", MessageBoxButtons.OK)[/FONT]
[FONT=Courier New] [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New] [COLOR=green]'If Not Ischar(e.ProposedValue) Then[/COLOR][/FONT]
[FONT=Courier New] [COLOR=green]'MessageBox.Show("Part Description must be entered", _[/COLOR][/FONT]
[FONT=Courier New] [COLOR=green]' "Error", MessageBoxButtons.OK)[/COLOR][/FONT]
[FONT=Courier New] [COLOR=green]'End If[/COLOR][/FONT]
[FONT=Courier New] [COLOR=blue]Case[/COLOR] "fldSalesPrice"[/FONT]
[FONT=Courier New] [COLOR=blue]If[/COLOR] [COLOR=blue]Not[/COLOR] IsNumeric(e.ProposedValue) [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New] MessageBox.Show("Sales Price must be numeric", _[/FONT]
[FONT=Courier New] "Error", MessageBoxButtons.OK)[/FONT]
[FONT=Courier New] [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New] [COLOR=blue]End[/COLOR] [COLOR=blue]Select[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]