ERROR - You tried to assign the NULL value to a variabe that is not a Variant data type

S

Scott B

Good Morning,

I have a form based on a query. I am using two fields from the query. I
have inserted a second form as a subfom. It is based on a table. The
subform works fine when I open it by itself, but that will not help me
because I want to have the records associated with the table in the
aforementioned query. I used the wizard to create the Form/Subform
relationship. The form/subform looks fine, I but get the following error
message when I try to enter data into the first field in the subform:

"You tried to assign the NULL value to a variabe that is not a Variant data
type"

The main form is not updatable, I use it to know what main form record I am
working on. I don't know what other info you might need. I have made
subforms many times before in what I thought was the same way, but I must
have done something different this time. Any help would be appreciated. I
checked the data sources in both forms and I checked the Link Child and Link
Master Fields and they seem correct.

One last thing. I can Ok the error message and go on adding data to the
form. It accepts the data and if I look at the table the data is there.
But it does not appear in the subform if I close the Form and then reopen
it. So the linkage must not be right. I have a relationship set in the
Relationship screen (Tools Menu) and changing the join type does not seem to
make a difference.

Thanks,
Scott B
 
D

Dirk Goldgar

Scott B said:
Good Morning,

I have a form based on a query. I am using two fields from the
query. I have inserted a second form as a subfom. It is based on a
table. The subform works fine when I open it by itself, but that
will not help me because I want to have the records associated with
the table in the aforementioned query. I used the wizard to create
the Form/Subform relationship. The form/subform looks fine, I but
get the following error message when I try to enter data into the
first field in the subform:

"You tried to assign the NULL value to a variabe that is not a
Variant data type"

The main form is not updatable, I use it to know what main form
record I am working on. I don't know what other info you might need.
I have made subforms many times before in what I thought was the same
way, but I must have done something different this time. Any help
would be appreciated. I checked the data sources in both forms and I
checked the Link Child and Link Master Fields and they seem correct.

One last thing. I can Ok the error message and go on adding data to
the form. It accepts the data and if I look at the table the data is
there. But it does not appear in the subform if I close the Form and
then reopen it. So the linkage must not be right. I have a
relationship set in the Relationship screen (Tools Menu) and changing
the join type does not seem to make a difference.

I think you're probably right, and the error is in the Link Master/Child
fields, or else in the recordsource of the subform. Please post the
values of these properties, and also the SQL of the main form's
recordsource.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top