470,647 Members | 1,099 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

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


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:

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,

Jul 26 '07 #1
2 2167
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,

Jul 26 '07 #2
14,534 Expert Mod 8TB
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.

Similar topics

1 post views Thread by middletree | last post: by
9 posts views Thread by Tony Williams | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.