you have tried to assign the Null value to a variable that is not of data type variant - access

别来无恙 提交于 2019-12-12 02:28:26

问题


Please press here for see the error in the gif. This is a new question as I am continue from my last question which can see here: Object variable or with block variable not set - Access 2013

Alright... I'm trying to get the names working, and it works as you can see in the gif. However when I'm adding a new person, this error just popped up and say "you have tried to assign the Null value to a variable that is not of data type variant"

And yes, it's in danish language in case you didn't know. it's in access 2013.

If there're anything I have missing, then please ask me any question.


回答1:


From what I can see, the only control on your main form is a list object which is being used to select the person that is to be shown on the subform.

I think this design is causing you difficulties.

Consider removing the need for a main form, by putting the control that chooses a person on the subform.

Also the subforms in the subform also seem un-necessary. I suspect that you could create a single form based on a single SELECT query that gets all the data you are currently displaying in your small subforms.

Because I can't read danish, it is difficult to understand you data, but the structure of your form actually looks wrong! eg it is VERU rare to need a person form with a subform that gives their names and is linked by personID!

I often recommend this youtube channel and also WROX Programming Access books. They both have examples of hw to structure a form.

I don't know how much experience you have of using Access, but you may find the above useful.

I commonly use an unbound combo box in the header of a form to allow users to select a person, and then use VBA code to goto the person and display their record in the form.

This technique is explained here: http://allenbrowne.com/ser-03.html

I hope this helps.



来源:https://stackoverflow.com/questions/32989871/you-have-tried-to-assign-the-null-value-to-a-variable-that-is-not-of-data-type-v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!