unreferenced control prob

  • Thread starter Thread starter mleczko
  • Start date Start date
M

mleczko

Hi,

I've got a combobox that I want to check before the user commits the
current record. How do you do it?

I've tried the following and got a combination of runtime errors,
there's gotta be an easier way

If Len(Forms.frmStory.PubCode) <> 2 ... doesn't work
If Forms.frmStory.PubCode = null ...
If Forms.frmStory.PubCode = ""

Help appreciated
Thanks
Nick
 
mleczko said:
Hi,

I've got a combobox that I want to check before the user commits the
current record. How do you do it?

I've tried the following and got a combination of runtime errors,
there's gotta be an easier way

If Len(Forms.frmStory.PubCode) <> 2 ... doesn't work
If Forms.frmStory.PubCode = null ...
If Forms.frmStory.PubCode = ""

Help appreciated
Thanks
Nick

Check how? Check for what? None of those form references is correctly
formed, as there should be a "bang" (!) after the word "Forms", instead
of a "dot" (.). However, Access may be able to figure that part out;
it's pretty clever that way sometimes. There are other problems in your
various tests, though. You might try one of the following:

' check for length not equal 2, allowing for Null
If Len(Forms!frmStory.PubCode & vbNullString) <> 2 Then

' check for Null
If IsNull(Forms!frmStory.PubCode) Then

' check for Null or zero-length string
If Len(Forms!frmStory.PubCode & vbNullString) = 0 Then

' check for zero-length string only
If Forms!frmStory.PubCode = vbNullString Then
 
Dirk,

Yes the bang thing seems optional, it definately works with a dot.

As for the ComboBox, I'll try your suggestions, the point of the
exercise is that the user has to choose something from the box, if not
they get returned to the control

Regards
Nick
 

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

Back
Top