Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BARCODE READER 1

Status
Not open for further replies.

100dtl

Programmer
Aug 18, 2003
313
GB
Hi

Your gonna like this.. not a lot. :-o

I have a barcode reader than scna most codes, what i'd like to do is setup some asp to catch the scan and then match it in match list then just confirm it...is this possible and where do i start, i have it comuicating to my pc so that bit is sorted .

many thxs in advance for any help
 
It's really no differant than receiving typed-in user input. Here's an example page that contains 1 text box. An employee scans his or her ID card, the form submits to itself, checks the value and then does other stuff based on other conditions. This should get you going:

<%Response.Buffer=&quot;true&quot;%>
<!--#include file=&quot;connection.asp&quot;-->
<!--#include File=&quot;Authenticate.asp&quot; -->
<%
function GetLanID(username)
pos=instr(username,&quot;\&quot;)
GetLanID=mid(username,pos+1)
end function
strName = request.servervariables(&quot;LOGON_USER&quot;)
strName = GetLanID(strName)
AuthUser()
IF AuthUser = FALSE then
response.Redirect(&quot;GotYa.asp?Page=EditPunch&quot;)
End IF
if request(&quot;flag&quot;) <> &quot;&quot; then
flag=Request(&quot;flag&quot;)
else
flag=0
end if
PunchOut = FALSE
PunchIn = FALSE
%>
<html>
<head>
<title>Time Clock</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<style type=&quot;text/css&quot;>
th{font-family:tahoma;font-weight:bold;font-size:14px;}
td{font-family:tahoma;font-size:14px;}
h1{text-decoration:underline:font-family:tahoma;}
</style>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<table align=&quot;center&quot; width=&quot;100%&quot; border=&quot;0&quot;>
<tr><td align=&quot;center&quot;><h1>Fulfillment Time Clock</h1></td></tr>
</table>
<br><br><br><br>
<table width=&quot;50%&quot; align=&quot;center&quot; border=&quot;6&quot; bordercolorlight=&quot;#F8BF24&quot; bordercolordark=&quot;#000000&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;>
<tr>
<th align=&quot;center&quot;>Please scan your ID card</th>
</tr>
<tr><td align=&quot;center&quot;>
<form name=&quot;input1&quot; id=&quot;input1&quot; action=&quot;<%=Request.ServerVariables(&quot;SCRIPT_NAME&quot;)%>&quot; method=&quot;post&quot;>
<input type=&quot;password&quot; id=&quot;ScanValue&quot; name=&quot;ScanValue&quot; size=&quot;75&quot; maxlength=&quot;75&quot; >
<input type=&quot;hidden&quot; name=&quot;flag&quot; value=&quot;1&quot;>
</form>
</td>
</tr>
</table>
<script language=&quot;vbs&quot;>
input1.ScanValue.focus
</script>
<%If request(&quot;flag&quot;) = 1 then
CardID = trim(cstr(request.form(&quot;ScanValue&quot;)))

set conn=server.createobject(&quot;ADODB.CONNECTION&quot;)
conn.open myConnString
strSql = &quot;SELECT EmpID, EmpName, Photo From tbl_c_Employees WHERE CardID = '&quot; & CardID & &quot;'&quot;
set rs=conn.execute(strSql)
if not rs.eof then
if not isnull(rs(&quot;EmpID&quot;)) then
EmpID = cint(rs(&quot;EmpID&quot;))
Photo = rs(&quot;Photo&quot;)
end if
EmpName = rs(&quot;EmpName&quot;)
response.write &quot;<table align='center' border='0'><tr><td align='center'><font size='5'><br>&quot; & EmpName & &quot;<br><br><img src=&quot; & Photo & &quot; width='110' height='150'></td></tr></table>&quot;
else
response.write &quot;<table align='center' border='0'><tr><td align='center'><font color='red'>There is something wrong with your card.<br>Please see the administrator</td></tr></table>&quot;
end if
set rs=nothing
strSql = &quot;EXEC tc_sp_PunchTheClock @EmpID = &quot; & EmpID & &quot;,@UserID='&quot; & strName & &quot;'&quot;
SET rs = Conn.execute(strSql)
InOrOut = rs(0)
myPunch = rs(1)
if InOrOut = 1 then ' Punching In
myVar = &quot;In&quot;
elseif InOrOut = 2 then ' Punching Out
myVar = &quot;Out&quot;
elseif InOrOut = 3 then ' Forgot to Punch Out
PunchOut = TRUE
myVar=&quot;Out&quot;
elseif InOrOut = 4 then ' Forgot to Punch In
PunchIn = TRUE
end if
set rs=nothing
Conn.close
set conn=nothing
If PunchOut = TRUE then
response.write &quot;<table align='center' border='0'><tr><td align='center'><font size='6'><b>You forgot to punch out yesterday. Please see the Administrator ASAP.</b></td></tr></table>&quot;
elseif PunchIn = TRUE then
response.write &quot;<table align='center' border='0'><tr><td align='center'><font size='6'><b>You forgot to punch IN Today. Please see the Administrator ASAP.</b></td></tr></table>&quot;
else
response.write &quot;<table align='center' border='0'><tr><td align='center'><font size='6'>&quot; & &quot;Punching <b><font color='#FF0000'>&quot; & myVar & &quot;</font><br>&quot; & myPunch & &quot;</b></td></tr></table>&quot;
end if
end IF
%>
</body>
</html>
 
Yeh but whats doing the scaning.. communication from the reader? calls to system etc..


thxs
 
Standard lazer barcode reader / keyboard wedge.
 
Still dont know... Must be some call to the serial port or something
 
Do you have a wireless barcode scanner that stores the information in memory? Or do you have a standard barcode reader that is plugged into your keyboard port? Sometimes, the wireless scanners have a base stand that is connected to the serial port. If that is the case, then the scanner should have come with instructions for downloading the data to your pc. It should create a text file and then you would have to import that into your application.

Much easier to use Veep's example with a standard barcode reader. Just use the keyboard wedge to plug both the keyboard and the barcode reader into the keyboard port. Place your cursor in the appropriate textbox and scan the barcode. The data would automatically be typed in the textbox as it is scanned.

Hope this helps answer your question.

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
No still not... Its basic serial port scanner and what i would like to do is add the code and quantity into XLS sheet at the same time update my database
 
100dtl,

You should make a table containing the list of items with their barcodes. Make an HTML page that has a text field (inside form tags) to contain the barcodes you capture with the scanner. You then pass the barcode value to an ASP page, and then 'select' the right item on the server side.

Medic
 
...Also check out this working sample:

<HTML>
<HEAD><TITLE>Barcode</TITLE></HEAD>
<BODY>
<%
barcode=request.form(&quot;barcode&quot;)
if barcode=&quot;&quot; then
%>
<form name=&quot;frmBarcode&quot; method=post action=&quot;<%=Request(&quot;SCRIPT_NAME&quot;)%>&quot;>
Barcode (type-in or scan):<br>
<input name=&quot;barcode&quot; maxlength=14>
<input name=&quot;OK&quot; type=&quot;submit&quot; value=&quot;Submit Barcode&quot;>
</form>
<script language=&quot;JavaScript&quot;>
document.frmBarcode.barcode.focus();
</script>
<%
else
Set CN = Server.CreateObject(&quot;ADODB.connection&quot;)
CN.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _
&quot;Data Source=C:\MyDir\MyDB.mdb;&quot;

set RS = CN.execute(&quot;select * from BARCODELIST where BARCODE='&quot; _
& request.form(&quot;barcode&quot;) & &quot;'&quot;)

if RS.EOF then
%>
Barcode does not yet exist.<br>
<a href=&quot;<%=Request(&quot;SCRIPT_NAME&quot;)%>&quot;>Try again</a>
<%
else
response.write(&quot;Barcode: &quot; & RS(&quot;Barcode&quot;) & &quot;<br>&quot;)
response.write(&quot;Description: &quot; & RS(&quot;Description&quot;) & &quot;<br>&quot;)
%>
<br><a href=&quot;<%=Request(&quot;SCRIPT_NAME&quot;)%>&quot;>Scan another barcode</a>
<%
end if
end if
%>
</BODY>
</HTML>


To make this code work:
1) create a C:\MyDir folder
2) create an MS Access database named MyDB.mdb inside the folder
3) in your database, create a table named BARCODELIST
4) create text fields named Barcode and Description in your table

These could help you start with your barcoding.

Medic
 
hi,

i'm also doing the barcode program in ASP with Access database. It works ok when it scan only 1 barcode in the textbox.

But, i need a multiple scanning of the barcodes in the textbox or listbox. (notsure which one is good.)
At the sametime, user can manually enter the barcode thru' the listbox/textbox. I have tried using listbox, but it disallowed user to enter.

Secondly, based on the scanning or manually enter, i have to count the no. of items being scanned and display in the another textbox.

All these steps have to be done before i click on the submit button. Which then saved into the Database.

I hope all of you understand what i am trying to say.
I have posted this in the Javascript Forum.

Thanks in advance, i seriously need help in this..urgently


Regards
icy111
 
icy111,

You can assign a separate textbox to enter the quantity if you are scanning so many items with the same barcode.

Medic
 
Medic

i am scanning many barcodes. I need to display how many(number) of barcodes i have scanned in another textbox.

Regards
icy111
 
100t,

If you have a serial port barcode scanner, then you will need some sort of software to catch the scnned information and send it to the open application.

If you had a PS/2 barcode scanner tha connected to a keyboard then it would automatically translate the barcode into charictors and inport those charictors into the open text box / text application you are running.

If it is a serial port scanner, the scanned data is lost at the serial port without an application to catch it.

Hope this helps,



Bary Smith
ASP, BKS, HTML, JS & CGI programmer.
BKS Graphic Design
 
FYI... I got it working thxs...

cheers medic...


Now i need to do this but its the wrong forum

I am Excel basic... I need to scan the product, excel then looks in a function that then matches it with an SKU number and then the cell next to it adds one, if i scan the same product i want the sheet to regonize its in the list then the count is two, i think you can understand the rest...

:-o

G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top