Populate text box on form

  • Thread starter MarieM via AccessMonster.com
  • Start date
M

MarieM via AccessMonster.com

I have subform on a Main form with two combo boxes and a text box.
I have code attached to the first combo box's After Update property which
limits the entries in the second combo box. Once the user selects an entry
from the second combo box, the phone field populates with the related phone
number. This is all working great.
However, when the user selects an entry from the second combo box that does
not have a related phone number entry, I receive a Run-time error - Field
'Phone' cannot be a zero-length string.
The Phone Number field is not always populated.

I removed the input mask I had on the field and changed the Allow Zero Length
property for the Phone field in the table to 'Yes', however I am still
receiving the error.

Any ideas would be greatly appreciated!
Marie
 
G

Guest

Try checking for Null before attempting to assign the value to the text box:

If not isnull(me.NameOfComboBox) then
'Assign the value here
end if

This is just air code but when you provide the name of your combo box and
check to be sure its value if not null, you should be OK.
 

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