MS Access Form single entry text box for barcode for multiple columns - vba

What I need is a single text box where I can scan a barcode. Every scan gets saved to a column in the table.
Table
1-----2----3----4----x1----x2----x3----x4
123--123--123--123---23----23----23----23
where 123 is the barcode entered in the form, and the "x1x2x3" are extracted from the barcode entered in the "123" by calculated field.
I have the rest figured out somewhat but I can't seem to find a way to have a single text box to enter number to different columns.
To clarify I want help in the form section, I need help on where I can scan the upc code in one box and have data captured from that upc saved in a 1 column in the table and the next upc scanned will be saved in another column. How can I accomplish this thru vba or any other method. In the form I'll have a date and around 56 boxes where the scanned barcode will be saved for each boxes.

Related

Is there a way to insert checkboxes and text boxes in Word using VBA?

I want to be able to populate a table of user defined length with one column of check boxes and one column of text boxes. For example, the user will enter a number of rows in a text box on a page, click a button, and generate this table. Is this possible using VBA? I have done this in excel but is there something equivalent for Word?

MS Access: Reset input field in form to default value 0 upon exit form

EDIT: The fields shown in pictures below all have "value list" as row source type. The input in these fields are used in queries that pull data from tables as well, but these fields themselves do not use any tables.
I have a form in Access that requires users to provide input via listboxes, and then queries use that data to perform calculations.
However,when the entire access file is closed, the same input values are still in the listbox after reopening.
Ideally I want the values in the input fields to default to 0 (not null) as soon as the access file is closed (or re-opened), so when the user opens the database, he will see the value "0" in those fields. The reason to why I want the value 0 as default is because the inputboxes reflect possible commodities a product can contain, and I want to allow users to define the % commodity a product does or does not contain. 0 means the product does not contain that commodity and the user does not have to change the value in the listbox (more user friendly in my opinion). Picture illustration:
Hence each time I re-open the access file, I keep seeing those input values above, while I want them to be 0.
I did some research but don't really understand how to use the expression builder, and I can't find a way to make it work via a macro. I read something about the listboxes having to be 'bound', but I'm not entirely sure how to deal with this.
This is the above listboxes in design view:
You are using listboxes but at a height of one selection which is not the optimal use for such a form control as no multiple listing is shown at once together.
Consider using free-form textboxes with a default value of zero. But if you need to control a user's input, use combo boxes which defaults to the zero selection item. Most likely right now, each listbox is defaulting to its first selection item.
Here is how the Property Sheet / Data Tab of the combox would look (in fact Default Value might be redundant as zero is the first item):
Row Source : 0;20;40;60
Row Source Type: Value List
...
Default Value : 0
If combo boxes use a table/query row source, you will need to append a value of zero with a UNION query:
Row Source : SELECT TOP 1 0 AS ColName FROM TableName UNION SELECT Val FROM TableName;
Row Source Type: Table/Query
...
Default Value : 0

How to program crystal report to lookup a record in a table

i Have a Table with Fields
Material Number
Order Code
Supplier Code
Description
I have a crystal reports rpt file that i manually enter all the information to generate labels.
I am trying to program this using the built in formula editor, so when i enter the Material Number (which is a unique code) it will automatically display other 3 relevant fields.
I have tried few formulas in the formula editor without any luck.
can anyone help?
relliK
UPDATE
#Siva - I have added the table for clarification
i simply want a lable printed with only one user input being the Material Number, and then the code/fomula in crystal reports to fetch the other data based on the Materila number and produce the label.
thank you for you interest in this issue.
UPDATE
#Siva - I have added a sample label, i would only want to enter 20506871 as Material and the other data fields to be pulled from excel
not sure if i can use parameter fields and/or i would like some help on programming the parameter fields

Access VBA code for copying information from a combobox and pasting into a textbox on a continuous form

Really need help with this, I have a continuous form with a combo box to choose data, each row has a different criteria and you can choose only certain items per row in the combo box drop down. (As an example I have four rows one is a cap, one is a bottle, one is a label and the last is oil to go in the bottle.)
What I need is when I have chosen something in the combo box drop down I want it to paste into a text box and stay there until another choice on the same row is made...... Currently I can make the information appear in the textbox but then when I move to another row and choose anothe item it over writes anything I have already chosen.
So an example would be I have chosen product 1, it has cap 1, bottle 1, label 1 and oil 1. In the drop down combo box I can choose only bottles to replace bottles caps to replace caps and so on. I want to choose bottle 2 in the combo box on the bottle line (Which changes all the combo boxes) I now want to save that choice in the text box on the bottle row only, then when I choose Label 2 on the label row even though it changes all the combo boxes I don't want it to overwrite the text box for the bottle row. (I'm assuming a criteria that will only change the row of the combo box you are clicking on or something like that)
hope this makes sense to every body (P.S. I don't know how to get a screen shot in here so have tried to explain to the best of my ability)
Many thanks
Justin
You have to bind the textbox to a field in the record.
As long as the textbox is unbound, it doesn't know about a record and will display the same for all records.
I'm making the assumption that you want to be able to map some product to 4 different types of caps, bottles, labels, and oil:
It seems that your problem is in your data table design, not in your comboboxes. You shouldn't need the text field at all. The problem is that your comboboxes are all based on the same table. When you select Bottle2 from one of them, it matches the rest of the comboboxes to that row. So all the others will get Label2, Cap2, etc. because they are in the same row of the table.
Make a products table call it tblProducts. The fields ID (autonumber), product_name, label_FK, cap_FK, Bottle_FK, and oil_FK should be in it. Those FK stand for Foreign key and should be a number type. The product name can be text.
Create the tblLabel, tblCap, etc. with an ID, and a description.
In your relationships you need to map the tblLable.ID to the tblProducts.Label_FK field. Do this for all 4 type. Then you can re-create the form based on the products table. Whatever the form gives you for the way to control the label_FK, cap_FK, etc. fields you can convert it to a combobox by right click -> change to...
Finally, you may need to update the number of columns of the comboboxes in order to see the description also.
EDIT: More lasting information -
Doing some solid research on data table design will pay huge dividends in design time. Starting with the Database Design Basics page from Microsoft will help as a decent 30 minute intro and should help clear some things up for you.

Continuous form with dependent combo boxes

I have a continuous form that has a dependent combo box on it. I have the dependent working individually for each row/record BUT the dependent combo box is blank unless it has focus then it shows the saved data so what I did was placed a text box over the data portion of the combo box and set its control source to the same field as the dependent combo box and required and it worked great BUT unlike a combo box which would show the name it shows the saved data which is a ID number so I guess my question is how can I show the name and not the data?
Thanks!
You'll need to clarify, but if the combobox is bound to a field of the form, and its RowSource displays two columns - say an ID and Name - then giving the first column a width of 0 will persuade it to display the Name, rather than the ID.
You will also need the Column Count to be 2 (or more) and the Bound Column to be 1 (the ID). Then set the Column Widths to 0cm;2cm (add more values if more than 2 columns).
Added
Remove this criteria from your cobmobox's Row Source:
[Forms]![frm_DelayMachineOutputSubform]![cboCategory]
It is not needed. The ActivityID (and the CategoryID) are obtained for each row in the form.
Remove these lines from the Current event as well:
Me.cboActivity.Requery
Me.txtActivity.Requery
again, they are not needed (and cause the flicker). Better yet, just delete this event-code.