473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Entering data into table

54
I am trying to track the order in which products are completed by their surface finish. We have 6 finishes. I have for each finish a button to specify that finish has been completed. Currently on the table I have a field for the date and one field for each finish. I am successfully adding the total number of each kind of finish per day. There is automatically a new record created each day. I just added fields labeled 1-99 into the table. I would like each field starting at 1 and ending at 99 to be populated with the title of the finish when any of the six buttons is clicked. For example: If I finish a nickle item then I click the nickle button. The field labeled 1 should be populated to say nickle. Then if I complete a black item and click the black button, the field labeled 2 should be populated to say black, etc. How can I tell it to populate the next empty field on the current record?
Oct 8 '14 #1
4 1348
zmbd
5,501 Expert Mod 4TB
Your database is not normalized.[*]> Database Normalization and Table Structures.

So how I would structure this (and this sketchy because I don't know your entire process):

tbl_customer - think adress book
tbl_products - think catalog
tbl_order - would track the projects in each customer order
tbl_project - this would have the project
tbl_finishes - your six finishes
tbl_projectstate - this tracks the projects and the finish.

Work flow, Customer JohnDoe - PrimaryKey=1
Orders three products (PrimaryKeys= 21, 25, 29)
So in table orders you have three records
Pk_order = 1; FK_Customer = 1; FK_Products = 21
Pk_order = 2; FK_Customer = 1; FK_Products = 25
Pk_order = 3; FK_Customer = 1; FK_Products = 29

Now you could omit the above and keep track of the customer order another way and take the above into the project stage

Now in table project

pk_project=1; fk_order=1; fk_finishes=1; fdate= mmd1yy
pk_project=2; fk_order=1; fk_finishes=2; fdate= mmd2yy
pk_project=3; fk_order=1; fk_finishes=3; fdate= mmd3yy
pk_project=4; fk_order=1; fk_finishes=4; fdate= mmd4yy
pk_project=5; fk_order=1; fk_finishes=5; fdate= mmd5yy
pk_project=6; fk_order=1; fk_finishes=6; fdate= mmd6yy

with similar entries for each of the other product orders and I've used MM#dYY as a generic date entry.

A few joins between the tables and the queries, pretty things up in the forms using look-up fields (comboboxes) and you're up and running.

Follow this thread to see how important proper layout in the beginning phase is to an efficient database
http://bytes.com/topic/access/answer...-layout-tables
Oct 8 '14 #2
Becker
54
So I went and changed around my recent addition to my table and split it into two tables linked together in a query by their primary keys. I think it is normal now. IDK for sure because I am so new. It made it look nicer though and I can see some areas in the future where is will make things easier.

Sometimes it is hard for me to explain what is in my head haha. Basically if I can figure out how to add text to the next empty field in the table (moving left to right) from a button on a form then I would be super happy. I sure hope it is possible.
Oct 8 '14 #3
zmbd
5,501 Expert Mod 4TB
We have an abundance of patience here...

sounds like you're starting from scratch... I'll pm you my boilerplate of tools. Please check your bytes.com inbox.

I'll give the most simplistic, crude, method here and once you work the tutorial in the boilerplate you'll be able to handle things in a more elegant method.

Normally a form is "bound" to a record source. What this means is that there is either a table or query that is associated with the form. The fields in the underlying table are then bound to the controls on the form.

For example, take a very simple table:
[tblone]![PK];[tblone]![FieldOne_text]; [tblone]![Fieldtwo_numeric]

(assume he datatype is indicated by the name)

So if you use the wizard to make the form, selecting this table as the recordsource. The form will have the record source property set to "tblone" and the the inserted controls will default to being named after their bound field as indicated in by their name and the "control source" property... in the this case: you would get three text box controls, named "PK", "FieldOne_text" and "Fieldtwo_numeric" this makes things confusing to say the least as the controls are NOT the fields.

To help illustrate this difference:
Open the form in design view.
Select one of the textbox controls and either in the ribbon or by rightclick show the control properties.
IN the {All}-Tab you can of course see all of the controls properties, the first field will be [name] (which is why you should not use that as a field-name), the second will be [Control Source] - using the wizard both are the same by default. Take a moment to look at each tab grouping so that you get an idea as to how the various properties are grouped... pay special attention to {data} and {events}

Lets change the control names so for each textbox on the form, go to either the {all} tab or the {other} tab and change the names (selecting each control of course (^_^) ).
ctrl_txt_PK
ctrl_txt_FieldOne_Text
ctrl_txt_FieldTwo_Numeric

There is a property "value" for each control and this is important... when you scroll thru the records on the form in normal view (or dataentry) the value of the currently selected record becomes the value of the control...
ctrl_txt_pk.value === value-of(currentrecord([tblone]![PK]))

following?

OK, next is your command button... add one to the form... cancel any wizards that show up.
Show the properties for the command button, and name it something useful, say, "ctrl_cmd_enterblack"
Goto the {events} tab for your command button...
Select the on_click event, click on the button with the three dots [...]
Select Code Builder

The VBA Editor window will open and you should have something like:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub ctrl_cmd_enterblack_Click()
  5.  
  6. End Sub
  7.  
now in
Expand|Select|Wrap|Line Numbers
  1. Private Sub ctrl_cmd_enterblack_Click()
  2.  
  3. End Sub
  4.  
enter
Expand|Select|Wrap|Line Numbers
  1. me.ctrl_txt_fieldone_text.setfocus
  2. me.ctrl_txt_fieldone_text.value = "black"
  3. me.ctrl_cmd_enterblack.setfocus
The setfocus forces the entry in to the record, then we alter the field, and by default when we set the focus outside of the record the record is saved.

Expand|Select|Wrap|Line Numbers
  1. Private Sub ctrl_cmd_enterblack_Click()
  2.    me.ctrl_txt_fieldone_text.setfocus
  3.    me.ctrl_txt_fieldone_text.value = "black"
  4.    me.ctrl_cmd_enterblack.setfocus
  5. End Sub
  6.  
this is the basic, crude, method. There's no error checking and is expecting the user to know what they are doing... etc... dates would be surrounded in "#" strings in quotes, and numeric values are "as is"
Oct 9 '14 #4
zmbd
5,501 Expert Mod 4TB
Now mind you, the last post is simply to get you running; however, I would not advise going down this path very far before starting from scratch with a properly normalized database.
Oct 9 '14 #5

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

Similar topics

2
by: jayderk | last post by:
I am writing an application that has I/O entering data in a text field. My question is. does the event "textchanged" fire as soon as the data starts changing.. for example... if 12345 is being...
2
by: Brian Mitchell | last post by:
Ok, I know this is an elementary question but I have a data grid that is bound to a data table and I can't seem to find a way to match the selected row in the grid with it's respective row in the...
1
by: Savas Ates | last post by:
i was given an url bla bla.wsdl i am asked for entering data using this wsdl url? is it possible? how can i do it? must i use asp.net werb services .. any url or example or way t solve it...
1
by: John | last post by:
Hi When using Table Adapter Configuration Wizard if 'Use SQL Statements' is selected as Command Type, the data table's name in dataset is retained and only its data adapter's select statements...
4
by: david.isaacks | last post by:
I have several combo boxes on a Access form and they work fine except then enter the ID number next to the text into the table and not the text. The Text shows up in the drop down and not hte ID....
1
by: laredotornado | last post by:
Hi, I have a data table on my page (buried amidst other images and extraneous text). I would like to spawn a new window that automatically prints the content of my data table, and only that...
4
by: lulaging2000 | last post by:
After entering data in the first text box I want to make the second text box to get focus when the Enter key is pressed instead of Mouse and Tab control. Is there any way to do that by making the...
4
by: indona | last post by:
hi, i have to enter data from a delimited file into sqlserver database table. i have been able to delimit the file and read the data into a data table, now i want enter the data table contents to...
1
by: BaseballGraphs | last post by:
Hello, I am trying to divide one value from my data table with an associated ID by another value from my data table with a different ID for the same day that the value was added to the data table....
1
by: rdrunner40 | last post by:
Hi, I have a data table that I created as below. I am selected using a sql statement to get 1 field to appear in combo box. What I would like to do then is to get the selected items from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.