Form data not writing to new records

Adrian510

Registered User.
Local time
Today, 19:44
Joined
Nov 24, 2005
Messages
38
Hello All

I am creating a production line database for use on a touch screen (no keyboard or mouse) which has to be really easy to use. At the start of the week i got to the point were i thought i would test what i had done to date and have come across a serious issue.

I thought that the data from the forms i am using to input the data to the main table tblProductionDetails would write into individual records but although new records are created at the appropriate point e.g. when the comand button labelled START on frmDetailsCorrect is clicked the data is not writing to the new record that is created. I thought it would be an easy thing to solve but 20 hours later and much mucking about with DoCmd.Goto's etc i am no further forward. I have attached what i have done in the hope it is something obvious and somebody will be able to point me in the right direction.

The way the db is set up is that frmDayStart needs to be opened the command button clicked and then each form opens once the OK comand button in the top right of each opened form is pressed.

It is still a work in progress so a bit rough and ready but i need to get this fundimental problem sorted before moving on.

Any help appreciated (i am not looking for somebody to do the work on the DB just point me in the right direction or point out what the error might be).

Regards

Adrian
 

Attachments

I don't have time to follow all of the logic around but in the first form you are not creating a new record when you click the button but just updating the first record.

In the form properties change "Data Entry" to yes.

I will try to look some more latter

HTH

Peter
 
Thanks for the pointer. I have just remembered that i am flying to Ireland tonight for a few days (Girlfriends birthday present) so won't be here to post anyway. If you do get a chance to have a look that would be appreciated.

Regards

Adrian
 
Thanks for the response Peter.

I have learnt some new things from going through the "Data Entry" help topics which is really good but unfortunatly it has not solved my problem.

Can anybody help?

Regards

Adrian
 
if you have set Data Entry to yes you should now be creating a new record when you click the button.
You now open form frmLineNumber but there is nothing to tell it which record you are trying to edit so it just edits the first record.
I think that rather than doing this by jumping in and out of differnt forms I would use a single form with a tab control.

Peter
 
Your code for the on Click of the Start button needs work:
Code:
InstanceEnd = Time
DoCmd.GoToRecord , , acNewRec
InstanceStart = Time
InstanceEnd is a field name not a control name. You will have to bind the field to a control for this to work, same with InstanceStart.

What is Time? If you want to return the current system time you need to use Now() which returns the current data and time.

Not sure why you are going to a new record in the middle of this.

I notice you are binding your forms to tables. It is better practice to use a query as this makes future changes much easier.
 
Hello again Peter

I would like to use a single form as well but unfortuanatly the data entry process has to be very very simple, i cannot use a keyboard or mouse and the text on the forms has to be very big.

I suppose i could copy the data from each of the forms that opens into a hidden form and use this as the data for each record but although i know this can be done i don't know to do it?

The Data Entry aspect of your post was very interesting and i will be using it in the future but in this instance i am not experiancing a problem creating a new record just writing the data from each form into the record.

After giving it some further thought i had been thinking about using me.xxxxxxxx or a global variable to pull the data from each form into the record but again i am not 100% sure how to do this and more importantly thanks to your post and neileg's I am not convinced this is the best way of achieving the result i am after?

Regards

Adrian
 
Looking at you tables I think that these may need some work as well.
You have tblProductionDetails related to tblProducts by the description field, it is better to join them by FinishedPartCode
You have tblCustomers related to tblProducts, which is fine if each product is unique to a customer, but you also have Customer in the tblProductionDetails. You dont need both.
Similarily with tblProductGroup, if a product can only be one or the other fine but if Standard/Express are two delvery method of the same product then again it should link to the tblProductionDetails table.

HTH

Peter
 
By using a Tab control you can essentialy have what you have now but on one form, you can hide the tabs and use Forward/back buttons to hide/reveal the relevant tab

HTH

Peter
 
Hello Neil

Thanks for your response

InstanceEnd being a field not a control has me confused. I am trying to insert a time value (hence Time rather than Now()) into the field of the record. I have had trouble with Now() in the past (especially as shifts often span 2 days) and i am going to capture the date in a seperate field. If i need to use this is a control could you explain or point me in the direction of an example?

The reason i am going to a new record in the middle of this is that after the InstanceEnd Time is entered i want to start a new record with a new InstanceStart Time and then capture the data from the forms to complete the fields in the record.

I am all for making my life eaisier in the future :-) by using a query rather than binding to tables, and i feel that the answer to the whole problem could lay within using a query in someway but again this is where i run out of knowledge could you point me in the right direction or give me a little more detail on what i should be doing to use a query rather than binding to a table?

Regards

Adrian
 
Hi Peter

I will have a good look at my table layouts and it looks like using Tab control could be the way ahead. So after a quick bite of lunch I will start searching the forum and learn about it.

Thanks for all your comments to date. Everything yourself and Neil have posted is adding to my knowledge making my databases better.

Regards

Adrian
 
Rather than storing Date and time seperatley just store the date/time stamp, You can always pull the values out seperatley when you need them. Just wait till you try applying date time math's to the night shift and you'll be glad of one field :)

Peter
 
Thanks for the advice Peter

I have also spent some time looking at tab control within forms and you are right it will definetly be easier using this method rather than lots of different forms although i can foresee a couple of problems which I hope you can help with.

1 can I hide the Tabs of the form (i assume its a set visable value to to false afair but i have not come across it yet)

2 having all the field data for the record on 1 form will make life a lot eaiser and means i won't have to use global variables (glad i learnt about them though as i am sure i will be using them in the future :-) ). However I think i will still be left with the same problem. What i need is a - when this command button is pressed

>Insert Now() into InstanceEnd
>Create a new record
>Insert Now() into InstanceStart
>Move back to Tab X (user then inputs the correct data by picking from list box and move to next TAB etc etc.)
>Click command button which populates the new record with all data on the form
LOOP

Its that last step again which i can see as the stumbling block.

Sorry if this is basic stuff but its a big new world of Access for me which is swaying between YES! thats really cool its doing what i want and ARRRAGGH! I know it can do it but i can't get there bang head on desk repeatedly.

I am working tomorrow so will be trying your suggestions and hoping it all works. So hopefully a good weekend when it all coes together. Any other advice gratefully received but otherwise have a good weekend.

Adrian
 
If you select the Tab control and look in properties there is a stle property that will let you choose Tabs/Buttons/None

>Insert Now() into InstanceEnd
You will probably do this using the before update event of the form. But this really is the end of the loop not the start

>Create a new record
>Insert Now() into InstanceStart
Set the default value for InstanceStart to Now() and it will do this for you as soon as the record is created

>Move back to Tab X (user then inputs the correct data by picking from list box and move to next TAB etc etc.)
you can navigate the tabs in code with "set focus", I think.

>Click command button which populates the new record with all data on the form
as long as the form is bound it should do this.

I am on on holiday for Christmas now :) and having to rebuild this PC so I cant check your DB at the moment, but when I looked at work there appeard to be no way to break out of the loop at the end of the day.

I think what you want is the form created with tabs plus navigation buttons, at the end of each loop they will need a choice of start a new loop or end for the day. either way you make your end timestamp here. If you do it with the before update event it will do it even if they bomb out of the DB.

HTH

Peter
 
Thanks for the post Peter

I have just got back after having my wisdom teeth out (thought i would be able to keep up with the forums and get some work done at home but the cocktail of drugs and a general anestetic they give you really knock you out (the screens still a bit wonky)).

I did manage to give it some thought and you are right on the money. I am going to start the forms from scratch again using one form and tabs. As it stands the end of day form was in place but you are right i had not got to breaking the loop at the end of the day yet.

Anyway I hope you have / had a good christmas.

All the best

Adrian
 

Users who are viewing this thread

Back
Top Bottom