Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validation of fields before adding a record
Message
 
To
15/10/1999 14:24:28
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00277026
Message ID:
00277092
Views:
29
>I have a form with textboxes (fields). When the user presses the Add Record button, the program validates the info in each textbox .
>I have a problem with the validation of the first field of the record:
>when the info in the first field is OK, the program runs fine (the record is added)
>when the info in the first field is wrong, I get the following error message:
>Can not insert an empty row must have at lest one column value set.
>
>and the .addnew line is higlighted
>
>here are a few lines of the code:
>
> With frmDelivrep.Adodc1.Recordset
> .AddNew
> If Not AllCtrlFiles.CheckTelco(frmAddDelivrep, txtTelco, lblTelco) Then GoTo TelcoExit
> .Fields!telco = txtTelco.Text
>
>TelcoExit:
> Exit Sub
>
>I think the problem is the program is expecting to add a record but because no fields are filled since the validation of the first field fails, I get an error. I have tried to update and to requry the recordset but I get the same error.
>

One thing is sure is that you should have a .CancelUpdate if you abort your .AddNew.

Is the error is coming the first time your .AddNew method is executed or the second time?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform