It's better to execute your query as such, and use the On Error to catch and handle any error you might encounter.
Dim strSQL As String
Dim curDb As DAO.Database
Set curDb = CurrentDB
.....
curDb.execute strSQL, dbFailOnError
Last edited by stmoong; 09-30-2011 at 12:04 AM. Reason: Amended "currentdb.execute" to "curDb.execute"
This is a much better approach.
Thanks Stan and please continue to help with this thread if you can.
Every answer can be and is a unique comment
If ths is the case then why would you want to default to the previous answer.
_____________________________________________
If you want to Default to the previous answer then you will need to use DLookUP. Search this out and see if you can understand it.
Last edited by Rainlover; 09-30-2011 at 05:59 AM.
Every answer can be and is a unique comment
If ths is the case then whay would you want to default to the previous answer.
Valid point however the first time anything is expected then it will be unique, however on a follow up inspection the default must be set as many things will remain the same for the specific piece of equipment and it will also serve as a reminder about what things should of changed as well
It is for quickening the data entry process
DoCmd.SetWarnings False" and "DoCmd.SetWarnings True"
These have now been removed, I will not use them again
Attachment 4656
Hi Rain and whomever else may read this I think I have come quite a way, however I am retiring for the night as I have been at it all day and my head hurts
I have attached the latest copy of my db for you to have a look at and there is still many things that need to be done. One major part I have been running around in circles with is trying to enter the IDs for the questions and answers in the results table as per frmEquipPressureVessel. I can enter the values into questions table (will be good later) and can enter EquipInspectID however can't work out how I can extract each ChecklistID and ChecklistAnswerID in my for loop. Any help with this code would be great.
Additionally I had a problem inserting into my junction table for equipment and inspection from frmEquipment, it works at the moment however only if I delete the relationships between Equipment, Inspection and the junction table
I know this is wrong but it is only way I could get it to work
Thanks for everything and to any 1 else that may be able to help
Try this. It is old but should help.
Ok getting much closer now, however still stuck in same parts. I read your tutorial and from that I take it that it is better to have a sub form for a many to many relationship. I have been trying all morning to create this sub form if only for equipmentID to keep the autonumber working, however no matter what code I use it cannot find the subform
if I use something like
[frmEquipment]![frmEquipmentSub].Form.[txtEquipment]
or the usual
Forms!frmEquipmentSub.txtEquipment
This part I assumed would be easy as the bit I really have no idea about is the code to add each checklistID and ChecklistAnswerID to the results table. 1 step at a time
Here is latest version however it keeps giving me more and more errors every time I convert it to 2003, Thanks
Attachment 4668
There is an Icon in your MENU TOOLBOX that allows you to attach a Sub Form using a wizard.
What is the name of the Form and SubForm you are trying to work on?
Hi Rain yes I have tried the wizard and I have tried creating it numerous times with different names and many different coding, no matter what I do it can not find the sub form
The forms name is frmEquipment and the sub form is frmEquipmentSub
it gets caught at the command button to add new inspection every time
Thanks
Why is frmEquipment unbound.
This is not part of my Tut.
I thought if I created an unbound form for main form, then I thought it should work as I can have all elements unbound and enter them into table that way except for equipmentID which is only thing handled by autonumber so I had subform bound to tblEquipment
sorry my mistake, I will try again
My mistake. It appears as though I posted an unfinished piece of work.
Best go and have a look at the working model. It shows in design view the Record Source and the join between the Sub and Main forms.
Look especially at the "Link Child Fields" and "Link Master Fields" in the properties of the sub Form.
As I look further this is an unfinished piece of work as the name used are not uniform. I must have lost the completed versions.
But the working model should help you out. Please excuse my misNaming of the various Forms.