WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Help with code

 
   Home -> Office -> Query DAO RSS
Next:  Query DAO: Microsoft Query Can't access table  
Author Message
Greg B

External


Since: Jul 11, 2008
Posts: 1



(Msg. 1) Posted: Fri Jul 11, 2008 2:04 am
Post subject: Help with code Add to elertz
Archived from groups: microsoft>public>excel>querydao (more info?)

I am having trouble with a piece of code, the code works with smaller
numbers but when I scan a barcode it does not recognise the number? What
have I got wrong here is the code below.
Private Sub UserForm_Activate()

TextBox1.Value = InputBox("PLEASE SCAN THE ITEM")


End Sub

Private Sub TextBox1_Change()

Dim CHECK1
Sheet5.Activate
On Error Resume Next
CHECK1 = Application.Match(CLng(TextBox1.Value), Range("A:A"), 0)
If Not IsError(CHECK1) Then
Label1.Caption = Application.Index(Range("B:B"), CHECK1)
End If
On Error GoTo 0

End Sub
Back to top
Login to vote
Dick Kusleika

External


Since: Mar 08, 2007
Posts: 20



(Msg. 2) Posted: Fri Jul 11, 2008 2:04 am
Post subject: Re: Help with code Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 11 Jul 2008 02:04:31 +0930, "Greg B" <littlelapDDD RemoveThis @ihug.com.au>
wrote:

>I am having trouble with a piece of code, the code works with smaller
>numbers but when I scan a barcode it does not recognise the number? What
>have I got wrong here is the code below.
>Private Sub UserForm_Activate()
>
>TextBox1.Value = InputBox("PLEASE SCAN THE ITEM")
>
>
>End Sub
>
>Private Sub TextBox1_Change()
>
> Dim CHECK1
> Sheet5.Activate
> On Error Resume Next
> CHECK1 = Application.Match(CLng(TextBox1.Value), Range("A:A"), 0)
> If Not IsError(CHECK1) Then
> Label1.Caption = Application.Index(Range("B:B"), CHECK1)
>End If
> On Error GoTo 0
>
>End Sub
>
>

Do you mean like barcodes with more than 15 characters. Excel has a 15
character precision limit, so a "number" that's longer than 15 digits will
be truncated. However, you would not have numbers like that in column A
because it's still Excel. I'd bet that the long barcodes in column A are
really strings and getting rid of the CLng call would help you match them
(but break the small numbers).
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Query DAO All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET