Search results

  1. B

    Cancel Adding New Record If Condition is True

    I did not get an error and it got to the second DCount; however, it seems to jump over the Cancel = True ...etc straight to the End if. Does DCount return 0 or 1? I don't understand whey you used <> 0.
  2. B

    Cancel Adding New Record If Condition is True

    I hope I have done this right. It did not work though. The code I have written was as follows: If DCount("[HouseID]", "tblHouse", "[HouseID]=" & Me!PlotNum) <> 0 Then If DCount("[PhaseID]", "tblHouse", "[HouseID]=" & Me!PhaseID) <> 0 Then Cancel = True Me.Undo...
  3. B

    Cancel Adding New Record If Condition is True

    Ok I will try it and see. The code definately looks smaller and less complicated.
  4. B

    Cancel Adding New Record If Condition is True

    If you have noticed in my code, I need to get the value of both phaseNo and PlotNo. I don't know if DCount can do that. I still don't know what it's parameters are, but it looks neater. Is it garanteed to run faster?
  5. B

    Cancel Adding New Record If Condition is True

    I am not familiar with DCOUNT functions. It does it pretty quickly with the code I have got at the moment that's why I did not think about alternatives.
  6. B

    Cancel Adding New Record If Condition is True

    The Me.Undo seems to have fixed it. The reason I am still using the recordset object is because I need to search through existing records in the database. Thanks :)
  7. B

    Cancel Adding New Record If Condition is True

    It's getting to that line because when I enter a plot Number that already exists, I get the message "This plot number already exist in this particular phase." & vbCrLf & "Please choose a different Plot Number" which is after Cancel = True.
  8. B

    Cancel Adding New Record If Condition is True

    That did not work boblarson. I hope I have added it to the right location of my code. I still need to use the record set object to get the condition in the if statment to work right. Here is the code with the change applied: Private Sub PlotNum_BeforeUpdate(Cancel As Integer) On Error GoTo...
  9. B

    Cancel Adding New Record If Condition is True

    Hi I wrote code that should validate a field when entering a new record and then if a condition is true, that new record should be cancelled and not entered into the table. I managed to partially achieve this by writing the code below, but the new record does not get cancelled because the...
  10. B

    3 Part Compound Key

    Your queries are great and they would work when pulling data from the database. I actually want to restrict entering duplicate plots into any one phase in the database. We are in two different directions I think :)
  11. B

    3 Part Compound Key

    My concern with that approach is if I use a merged UniqueSitePlotNumber, it won't help solve this issue. Plot numbers can repeate within a certain site, but they can't repeat within a certain phase. So, by using UniqueSitePlotNumber, there will be no way to stop repeating enteries for plots...
  12. B

    3 Part Compound Key

    I don't think you understood my question ortaias. How would I know what plot in what phase if I just reference site and plot directly? Can you please elaborate? Thanks, B
  13. B

    3 Part Compound Key

    I managed to find and create indexes; however, I still haven't managed to get the functionality I want. Do I need to set both of them to Unique and Ignore Nulls? I want to be able to enter records where half of the (compound index) can be duplicated, but both can't. For example: Record 1...
  14. B

    3 Part Compound Key

    I don't quite understand your post neileg. Do you mean I can index two field that are not PK with an compound index? Not sure how to do that...
  15. B

    3 Part Compound Key

    Hi, I have searched on this forum about a solution to this and found out that 3 part compound keys are unwise although they are legal. Now, I am not sure how to design this database! Basically, I need to store information about site (a big part of land), phase (a portion of site) and Plot (a...
  16. B

    Default records tables design

    Cool, that clarifies it. Thanks.
  17. B

    Making a DB executable

    I did not know you could modify MDE files. What do you mean by full version? Also, would an MDE file work in exactly the same manner as an mdb file? Thanks, B
  18. B

    Default records tables design

    Thanks The Doc Man. Would this approach eliminate repetition of records that don't need to change?
  19. B

    Default records tables design

    Hi, I have a table that stores default information called 'dat HouseType'. The information on this table appears on a form depending on the value users select from a combobox on another form; however, there will be situations where users need to change some of the fields for certain records in...
  20. B

    Can a combo box accept input?

    That's great - Thanks.
Back
Top Bottom