Minds gone blank - dealing with if record empty then... Else...

shabbaranks

Registered User.
Local time
Today, 15:52
Joined
Oct 17, 2011
Messages
300
Hi guys,

Ive got monday mind block (if there is such a thing)?? Trying to deal with if then else statements. Whats the best way of going about working with if a field is blank then, within a VBA statement. Ive written the obvious

Code:
    If Me.telnumb_txtbx = "" Or IsNull(Forms![NewContact_Frm]![telnumb_txtbx]) Then
    Dbtelnum = "0"
    End If

But obviously this isnt any good if there is a record in the form field.

Help is "as always" appreciated :)
 
Is the current form (me) the same as NewContact_Frm? If so, why are you referencing telnumb_txtbx in two different ways? I suppose it doesn't hurt anything -- it's just confusing. If they're in two different forms, why are you looking for "" in one and null in the other?

Either way, you haven't explained what the problem is. You have a simple If statement that should work. If you need to add an Else, then do so.
 
Last edited:
Got it working, just needed to think about it logically. A slight issue now is the VBA code is removing the preceeding zero from the form. So a number is 0298785487 its captured as 298785487 - any ideas why this is?

Thanks
 

Users who are viewing this thread

Back
Top Bottom