Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49

    How to apply a MID to a field????

    how can I get a six character string to be pulled from a 18 character string in realtime.



    For example, I scan in a barcode and only need 2-7 out of the scanned in string. is there a macro for this???

    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    The syntax would be something like this.

    MyField = Mid(ScannedInString,2,6)

    see http://www.techonthenet.com/access/f...string/mid.php

  3. #3
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    I'm still having trouble with this. I am pretty new to these functions and don't know too much about them. Where do I put the function?

    For example, The field that I am inputing the string into is field one. It is also a lookup box on a form. So before the form looks up the record, the mid function would have to be completed otherwise I get an error saying that I have entered an invalid choice.

    Does this make sense?

  4. #4
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    OK, I think I have figured it out.

    On another not, is there anyway to convert a base 32 to a base 10?

  5. #5
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    Ok, I have another problem.

    On my form, I made a text box, named Text17. the expression that I typed in the combo box that I am using to look up my records is =Mid([Text17],2,6
    This does a great job for pulling the string, but the Combo box fails to lookup the record that is asociated with the entry.

    What am I doing wrong???

  6. #6
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    I really think I was asking the wrong question. What I want to do is to Mid the data in the text box as soon as it is entered.

    I know that the function is =mid(stringexpr,strat,length

    However, when try to put the function in as this, mid([text51],2,6) I create a loop since I am trying to mid the string that I just entered in that box.

    I know I can do it in a seperate box, but i would like to know how to do it in the same box. Can this be done or am I wasting my time?

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    I think you have to step back and tell us what you are trying to do--- plain English. There may be options.
    I think your description is more of a how, rather than what.

    Where do you plan to use this? in a query using the query wizard? Or in some vba Loop process? How many of these things do you have?

    Give us a picture of what the whole application is, and maybe someone will have more specific advice/recommendations.

    Also, there is a closing bracket with MId. i your Post #5
    =Mid([Text17],2,6

    syntax wise should be =Mid([Text17],2,6), but this is saying take positions starting in 2 fr a length of 6 BUT the string it's working on is Text17 NOT WHAT YOU WANT!!!!!

    In vba terms on your form (known as Me.) I think this would apply:

    Me.text17 = Mid([InputString],2,6) where input string is the value you are getting with the barcode. And you would have this is the AfterUpdate event of the textbox or whatever where you place the barcode before parsing it.

    But you're going to have to describe the big picture in order to resolve the issues.

  8. #8
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    Orange,

    First off, thank you for tyring to help! I am really lost here.

    This is what I am trying to do:

    I have a form that is used during a registration for conferances that I put on. My boss would like to go to using scanners to find the record. The problem is that the barcode contains a lot more data then I need to look up the record. All I need is Character 2-7. I would like to be able to scan into a combo box, or a text box and isolate the needed data and then look up the record.

    the form only pulls from one table.

    Any ideas?

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    What exactly is the process for the barcode? I haven't used one. But if it reads data (via scanner) and puts a code into a fixed location --- eg a field in a table, then I can see how you might process it.

  10. #10
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    the barcode scanner basicaly Emulates a keyboard. The barcodes that I am scaning contain numbers and letters, 18 of them to be exact. when I scan it the scanner will type them in and press enter. I need to pull 2-7 out of that mess.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    The scanner "types" them where exactly? Table and field name.

  12. #12
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    I originally had it typing into the combo box that was on my registration form that I use to look up the record. The scanner will me scanning into a box on a form though. I can make it scan into any box, But I do need it to be able to pull up the record to populate the form.

    Does that help?

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    Maybe. So you scan something and get a barcode, then you want to look up records in Table??? that match that barcode? You said you had 1 table, what does it look like?

  14. #14
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    The table has about 85 fields on it ranging from SSN's to addresses and family members addresses and such.

    the form that I am using to veiw the records has 69 fields that will hopefully be filled as soon as I scan the ID card.

    each record has a 6 digit identifier that coresponds with the 2nd through 7th digit in the barcode. The other digits on the barcode contain other information that I do not need nor have.

    So by isolating the 2-7th digit of the barcode, I am hoping to lookup the record on the form.

    Thanks again

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,736
    So, on a form make 2 textboxes
    1 --- txtIncomingBarcode
    2 --- txtDesiredCode

    make the scanner "type " the barcode into txtIncomingBarcode

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Apply Filter based on unbound date boxes
    By anoob in forum Access
    Replies: 3
    Last Post: 01-21-2011, 05:26 PM
  2. Replies: 5
    Last Post: 10-06-2010, 07:28 PM
  3. Apply filter command
    By miziri in forum Forms
    Replies: 6
    Last Post: 01-21-2010, 02:22 AM
  4. Using a form to apply a condition to a Query
    By JeepWidow in forum Forms
    Replies: 0
    Last Post: 12-22-2008, 10:29 AM
  5. Apply check at record level
    By wasim_sono in forum Programming
    Replies: 1
    Last Post: 04-19-2007, 07:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums