Rabu, 16 Januari 2019

[MS_AccessPros] Re: How to get the first letter of an inputBox

 

Hi Kevin


You need to be more specific than to say "the above code doesn't work".

What DOES the code do? Are you familiar with debugging techniques?  I suggest you set a breakpoint on the line that begins "If Left(...".  Then, when your code stops there, you can examine strInputBox by typing in the Immediate window:

?strInputBox

You can then press the F8 key to step through the code one line at a time. You will then see if the code enters the If ... Then block.

Actually, I can't see anything wrong with this code snippet, so maybe the problem is occurring somewhere else.

By the way, I hope you have "Option Explicit" at the top of EVERY code module.  You do not appear to be declaring several variables, although these might be declared elsewhere.

Best wishes,
Graham [Access MVP 1996-2016]


---In MS_Access_Professionals@yahoogroups.com, <qingqinga@...> wrote :

Dear All,
How do we get the first letter of an inputbox? For example, if I type "a123", how the I get the "a"?
By the way, here's what I have tried:

Dim strInputBox As String
strInputBox = InputBox("Please enter the ID.", "")

If Left(strInputBox, 1) = "a" Then
strfrm = "frmTransaction"
strID = "TransactionID"
strFormTable = "tblTransaction"
End If

But the above code doesn't work.

Best Regards,
Kevin

Zhao LiQing

__._,_.___

Posted by: graham@mandeno.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar