By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

Update subform query with barcode

P: 3
I program vba in excel but am having quite a few problems with access.I have a query that i type quantites into after i take orders which then calculates prices. i am trying to enter that data by scanning a barcode into a textbox. i was able to do this for a table but how is it done for a query? thanks for the help.
Apr 19 '10 #1
Share this Question
Share on Google+
6 Replies

Expert 100+
P: 931
So, when you scan a barcode, the value in question is going to a text box on a form and displaying correctly? What kind of data is encoded in the barcode?

Apr 19 '10 #2

P: 3
the item number and its weight or somtimes just the item number. I can handle all the coding as far as the check digit, or differentiating between the types of barcodes, (ive done all this in the past with excel), but i have no clue how to get the info into the query so the price can be calculated. in excel it would be something simple like
Expand|Select|Wrap|Line Numbers
  1. cell(4,"A") = len(barcode,3,4)
but access is apparently a whole different ballgame.
thanks for the help
Apr 20 '10 #3

Expert Mod 15k+
P: 31,769
Sometimes we ask questions in the hope that the answers will give clues as to what members are not very good at explaining in words. It is very important that the answers are correct and accurate. Unfortunately it seems you have taken no care to reply accurately. This code is not workable (It would fail even to compile). It therefore tells us nothing (except about you).
When posting any code on here please :
  1. Ensure you have Option Explicit set (See Require Variable Declaration).
  2. Try to compile it. If it doesn't compile for any reason please explain that clearly - including the error message and which line of your code it appears on. Compilation is done from the Visual Basic Editor menu - Debug \ Compile Project (Where Project is the actual name of your project).
  3. Copy your code (using the Clipboard - Cut / Copy / Paste) from your project directly into your post. Typing in code is not appreciated as it is likely to introduce typos which cause members to waste their time unnecessarily.
  4. Ensure that the code in your post is enveloped within CODE tags. The hash (#) button in the posting page helps with this. Simply select your code and click on the hash button to have it enveloped automatically.
If all these points are covered then all members will be better able to understand, and therefore attempt to answer, your question.
Apr 20 '10 #4

P: 3
Neopa, Maybe should have read my question before jumping to point out that i put in some code that doesent work. Of course it wont work because its referencing a cell. last time I checked there were no cells in access. The code I stuck in was not code that im using, it was merely to give an idea of how i would do it in excel. If anything else is unclear il do my best to explain, but maybe you should read the whole post before you jump to edit next time
Apr 20 '10 #5

Expert 100+
P: 931
Hi -

In your original post you stated that you were "able to do [it] for a table"...and what I was trying to get at in my response is exactly what you do have working in Access, which will allow us to move forward. So, what exactly do you mean in saying that you have it working for a table?

Your wording in relation to the query is confusing me. When you say that you "type quantities into" the query, do you mean that you are entering parameters into a form which then get passed to the query?

I'm not trying to badger you...I just need very clear and specific information about where you're at so that the right advice can be offered.

Apr 20 '10 #6

Expert Mod 15k+
P: 31,769
If anything else is unclear il do my best to explain, but maybe you should read the whole post before you jump to edit next time
Perhaps you can explain to us what value is likely to be returned by the len() function in your posted snippet then. I too have done a little coding in Excel, and I've never seen it work (or even compile) with three parameters passed as you posted. It was also clearly not viable code for various other reasons (EG. len() would never occur in working code except in a string or a comment as the IDE would always convert it to Len() - but clearly not to Mid() as is your obvious expectation).

Personally I'd be ashamed to post something I clearly hadn't bothered to check over first, especially when requesting free assistance, but if you feel defending such behaviour aggressively is how you want to play it, then fine. Everyone can read what has been said and I have no cause to feel embarrassed.
Apr 20 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.