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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to create form that will open another form and retrieve a record.

Status
Not open for further replies.

mpruett

Programmer
Jul 22, 2005
13
0
0
US
I have a bar-code reader, and what I'd like to do is create a simple form with one text box, and then after scanning the barcode, open up another form that will find the scanned item's record and display it ready for editing.

The bar-code reader is a keyboard wedge product, so it basically acts like a text stream; in other words, if I scan a bar-code, the input from the reader comes in as if I'd typed whatever it scanned, with an <ENTER> at the end.

Basically I want to scan it, and have it automatically open the item viewing form with the proper record already retrieved.

I don't have much of an idea how to do this- it seems simple, but I'm not sure where I'm dropping the ball!

 
Thsi concept is very simple.
1. Your scanner is like your keyboard (since you are using a wedge).
2. Have a textbox on a form running and the cursor is in the textbox.
3. Scan you item, the result should show up in the textbox, including the delimeters (normally a * at each end of the string).
4. If your values are always the same amount of characters, use your inputmask to determine the length, and once your scanner scans it will reach the end specified, and now put your code to locate your record in the valid of the textbox (stripping the * first).


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
I guess I should have explained more- I can get the form to open the second window and populate the textbox I'm looking for, but when I'm in the second form, I just don't know how to get it to automatically find a particular record.

 
Can you use the InteractiveChange method of the Text box to interactively look for the end of character string (typically a CR) or look to see that the expected number of characters had been "entered"?

Then when the end of barcode string is encountered, have the same method do a SEEK or LOCATE within the associated table to find the desired record.

Good Luck,
JRB-Bldr
 
Mostly likely a timing issue. Locate you record in the first form, and in the init of the second form, put a parameter (something like the recno() of the record you found, or unique ID) and from the first form use something like :
Code:
do form form2 with rec_no


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
I am with mgagnon on this. Why have an additional form when one does not seem to be necessary.

Why not have the form with all the textboxes you need. Have the scanned info in a textbox with the following code in the Valid :

select database
** if there is an index use it, otherwise use a locate for
set order to tag whateverthetagnameis

if seek(thisform.textbox.value)
** record found refresh screen
** I am assuming the textboxes have their control source the same as the table

else
** no record found let user know
messagebox("Record Not Found",0,"Search Returned No Results")

endif

Having a second form opens up many other issues you do not want. I know, I used to make this mistake all the time.



Don Higgins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top