Search results

  1. MajP

    Mandatory FK values? "You cannot add or change a record because a related record is required in table"

    My bigger point here is that the default for a nueric fields is 0 and that is almost never appropriate if that field is used as an FK. Why MS does this is just dumb. It causes more problems than helps. Since most time we are relating to a PK autonumber that can never be zero. So if you...
  2. MajP

    Correlation between two records of the same table

    When someone says a procedure does not work, I am assuming that means nothing happens. (no error message) one of the first things to check in those cases where nothing happens if if the code is firing. Is it being called correctly. I check this quickly with a messagebox. Private Function...
  3. MajP

    Mandatory FK values? "You cannot add or change a record because a related record is required in table"

    One problem is now a numeric fk defaults to zero unless you change it. Do not know why they just do not set the default to null.
  4. MajP

    Correlation between two records of the same table

    If this is the case, how would I do it? Lets say we are associating products that can be swapped out. And say it is true that if A can replace B then B can replace A. If B can replace C then A can replace C and C can replace A. I would save both directions of the relation. So if you save the...
  5. MajP

    Correlation between two records of the same table

    It is fully make believe and not really a working solution, just a demo of some concepts. I do not even know what kind of data the OP has. It is make believe data and probably not a good choice. That could be determined by the real data fields. Healthier alternative is better example since...
  6. MajP

    Correlation between two records of the same table

    Hard to see and debug. I would put a msgbox here in the code. That way you can ensure the function is called, and see that the sql is correct. .... msgbox StrSql debug.print strSql CurrentDb.Execute strSql ... if the function is being called this should also print the sql string to the...
  7. MajP

    Close and reopen form to specific record

    I am not saying that is wrong design, but it sounds suspect. usually it would be the other way. Example I have a Task with child Action Items. If all the action items are complete the Task status is updated to Closed. Can you explain? Anyways from the main form event you requery the subform...
  8. MajP

    Close and reopen form to specific record

    IF the thing you are searching for is a string you have to put single quotes around the value forms("Formname").recordset.findFirst "SomePKField = '" & ID & "'"
  9. MajP

    Correlation between two records of the same table

    I have built so many examples and demos that I have lots of demo databases and do not have to build new things or have new ideas. Remember, this is just an example of some concepts. Not meant to be a real solution. There are lots of different ways to do that, so the more specific your real...
  10. MajP

    Close and reopen form to specific record

    dim ID as long 'assumes primary key is numeric adjust as necessary ID = forms("formName").PKfieldName DoCmd.Close acForm, "formname" DoCmd.OpenForm "formname" forms("Formname").recordset.findFirst "SomePKField = " & ID However, you should not need to close the form to update the subform.
  11. MajP

    Length Efficiency Calculator

    If you have not noticed this is a well known problem and many people selling solutions. If you cannot build it yourself or get online when needed to one of the free versions, many of these companies offer stand alone options that import and export to excel (also have APIs) for a very cheap...
  12. MajP

    Correlation between two records of the same table

    Here is a simple and silly example. The concept is that you may need some robust features to find and subjectively link items. Assume you have products from the Northwind market Products Products Product Name Description Standard Cost List Price Reorder Level Target Level Quantity Per Unit...
  13. MajP

    Correlation between two records of the same table

    I will make a demo, showing a few capabilities.
  14. MajP

    Length Efficiency Calculator

    This one has the ability to import all properties from excel. Handles irregular stock too. https://www.opticutter.com/linear-cut-list-calculator
  15. MajP

    Correlation between two records of the same table

    That may work for you, I do not know. But scrolling thousands of products with little information may not be easy. I do not know how much information you need to see to determine if there is a relation. You may need something more robust. Lets say I have thousands of products. Shirts, Pants...
  16. MajP

    Solved Problems with code execution following email

    Never do that. You never want to use error handler to manage code execution. Avoid gotos all the time. That mail error should just be part of the code an not where you have it IMO. The best construct IMO if Isdate(me.finalAuthorisationDate) then msgbox here else run code here end if...
  17. MajP

    Length Efficiency Calculator

    Yes, but no one does it that way. No model will test all alternatives. As I said this is an extremely well known problem with proven methods to get an Optimal solution. It can be solved as a traditional Linear Program or many solutions use Column Generation so as not to have to do exhaustive...
  18. MajP

    Length Efficiency Calculator

    You definitely need to address leftover and the precise rules. There is a whole subset of models dealing just with this topic. Often there is a length of leftover that is a partial penalty because you can use it in future cuts. It is a partial penalty because you want to use full sheets first...
  19. MajP

    Correlation between two records of the same table

    If you have to do a lot of associations. A subform approach may not be the easiest to use. You may want a checklist where you can quickly see and pick related items. May be interested in ways to do this...
  20. MajP

    Solved Problems with code execution following email

    If IsNull(Me.FinalAuthorisationDate) Then MsgBox "Please add the date", vbOKOnly End If I think you need an exit sub. You will get a message but the code will continue.
Top Bottom