Change focus and copy if text field is empty. (1 Viewer)

Bar_NZ

Registered User.
Local time
Tomorrow, 07:59
Joined
Aug 14, 2012
Messages
48
Hello, can someone please help me, I have the code shown below and I'm having an issue, could you please help me?

What I have is two phone number fields MobileNum and InternalNum. On click I would like to look at the InternalNum if it has a value, then copy it to clipboard and open the Jabba, if it is empty, then move to the MobileNum field and copy the value into the clipboard and open Jabba.

Then it opens our Jabba phone app, so I can paste the number and hit enter to dial it.

Code:

Private Sub Command21_Click()
If InternalNum.Value = "" Then
Me.MobileNum.SetFocus
DoCmd.RunCommand acCmdCopy
Else
Me.InternalNum.SetFocus
DoCmd.RunCommand acCmdCopy
Call Shell("""C:\Program Files (x86)\Cisco Systems\Cisco Jabber\CiscoJabber.exe""")
End If
End Sub


Any help would be greatly appreciated, thanks.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:59
Joined
Aug 30, 2003
Messages
36,126
What's the issue? From the sound of it, I'd expect the jabber app to be opened either way, after the end if.
 

Bar_NZ

Registered User.
Local time
Tomorrow, 07:59
Joined
Aug 14, 2012
Messages
48
Sorry, I may have focused to much on the Jabba app, yes that does open, where I'm coming unstuck is it seems to stop at the second DoCmd statement. All I want to do is if the InternalNum is empty, copy the value in the MobileNum.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:59
Joined
Aug 30, 2003
Messages
36,126
Does it work with this test?

If Len(Me.InternalNum & vbNullString) = 0 Then
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:59
Joined
Aug 30, 2003
Messages
36,126
By the way, since we were talking about it earlier, we had a great trip to NZ. Didn't have a chance to take the train you mentioned, but probably did a similar route in our rental car. Drove from Queenstown over to the west coast, eventually crossing back over to Christchurch from Greymouth (which was the train route you recommended). We did take the train from Auckland to Wellington, which was nice.

Love your country and the kid seems firmly rooted there, especially since they just bought a house, so we'll be back!
 

Bar_NZ

Registered User.
Local time
Tomorrow, 07:59
Joined
Aug 14, 2012
Messages
48
Hey Paul, havnt had a chance to try this today, but hopefully over the weekend. I am so happy you enjoyed your time here, yes the trip from Greaymouth to Christchurch was the one I recommend. Next time you come, call into Wellington and I'll buy you a coffe for your help.
 

Bar_NZ

Registered User.
Local time
Tomorrow, 07:59
Joined
Aug 14, 2012
Messages
48
Hey Paul, that worked a treat, thank you very much. Next time your in town, I'll buy you a coffee.


Cheers
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:59
Joined
Aug 30, 2003
Messages
36,126
Excellent! I'll take you up on that, if I can substitute a hot chocolate. :p
 

Bar_NZ

Registered User.
Local time
Tomorrow, 07:59
Joined
Aug 14, 2012
Messages
48
Hot chocolate, no problem..
 

Users who are viewing this thread

Top Bottom