By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,786 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,786 IT Pros & Developers. It's quick & easy.

Controls do not appear to bind to the fields in an empty recordset

P: 7
Hi,

i have a form that normally has a Recordset containing only one record bound to it.

i have replaced the navigation buttons with my own and the 'New Record' button assigns an empty Recordset to the form and then uses <recordset>.AddNew to create the new record. the query that i use to obtain the empty recordset (so i bind the controls as normal) is:
"SELECT TFiles.Id AS FileId, TFiles.* FROM TFiles WHERE TFiles.Id=0"

this query is the same as the one to obtain the single record for the form normally. the TFiles.Id field is an autonumber and therefore does not have a 0 value in the records. <recordset>.RecordCount returns 0 for this recordset.

however when i enter the data in the controls and run <recordset>.Update i am given the message:
"Run-time error: 3314

The field 'TFiles.FileRef' cannot contain a Null value because the Required property for this field is set to true. Enter a value in this field."

if i turn set the Required property to 'No' in the table definition for this field the next required field produces the same message.

why do the controls not bind correctly to the fields in the EMPTY recordset??

i came across this error at the following site:
http://www.insteptech.com/techLibrary/vbClassic/vb6_bugs.htm


also i have tried using no recordset on the form, but then any bound controls can no longer be referenced in code by their names!! why??

thansk for your help,


Peter
Jul 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: 7
just to make things worse when i use the .Update method and receive the 3318 rte, the record had actually been entered successfully!

why does this happen? can i just suppress the error messages? and if i do what happens if something else goes wrong and i dont know about it?

thanks again,

Pete
Jul 26 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi Pete

Why is the form bound to a recordset?
Aug 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.