none
Do.cmd openform with a WHERE argument is not working half the time. RRS feed

  • Question

  • I've looked around for this, it seems i'm the first one to experience this problem.

    I have 7 records on the main form. I have a details button to see details of each record.

    Every other record comes up null. Every Record in-between comes up fine.

    So, to be 100% accurate, this is how it is currently.

    Record 1: null
    Record 2: Works
    Record 3: null
    Record 4: Works
    Record 5: null
    Record 6: Works
    Record 7: null

    lookUp = "[EmployeeName] = '" & name & "'"
    
    DoCmd.OpenForm "PayrollPeriod", acNormal, , lookUp

    I have Checked the spellings of the records coming up null. I have even checked the ASCII to ensure there was no UNICODE.

    Isn't it odd that it's every other record?

    when the next form opens, EmployeeName = null


    • Edited by JoseKreif Monday, September 14, 2015 4:40 PM
    Monday, September 14, 2015 4:40 PM

Answers

  • Solved,

    After seeing that this was record specific I looked at the record source for the second form. The tables were joined wrong causing only specific records to show up. I fixed it.

    I'm helping my co-worker with this database, he is still learning Access so there has been a lot of places here and there that things haven't been done right.


    • Marked as answer by JoseKreif Monday, September 14, 2015 5:07 PM
    • Edited by JoseKreif Monday, September 14, 2015 5:07 PM
    Monday, September 14, 2015 5:06 PM

All replies

  • Hi. Since the code you're running doesn't change for each record, then the issue must be with the data. Have you tried running it with a different set of data? If the data is correct, then it's also possible (although unlikely) that your form may have gotten corrupted. Try creating a new form with the same code against the same data just to check if the problem goes away. If it doesn't, then that should again point to the data. Just my 2 cents...
    Monday, September 14, 2015 4:43 PM
  • Hi. Since the code you're running doesn't change for each record, then the issue must be with the data. Have you tried running it with a different set of data? If the data is correct, then it's also possible (although unlikely) that your form may have gotten corrupted. Try creating a new form with the same code against the same data just to check if the problem goes away. If it doesn't, then that should again point to the data. Just my 2 cents...

    I've experienced so much corruptions, bugs and glitches in Access, you're probably right. i'll  create a mock-up form and run the same code.

    EDIT:

    Same exact issue. However, I changed the order of the records. It's not every other record now. The same records as before are still coming up null. So this is something to do with these specific records.

     
    • Edited by JoseKreif Monday, September 14, 2015 4:56 PM
    Monday, September 14, 2015 4:49 PM
  • Good luck!
    Monday, September 14, 2015 4:57 PM
  • Solved,

    After seeing that this was record specific I looked at the record source for the second form. The tables were joined wrong causing only specific records to show up. I fixed it.

    I'm helping my co-worker with this database, he is still learning Access so there has been a lot of places here and there that things haven't been done right.


    • Marked as answer by JoseKreif Monday, September 14, 2015 5:07 PM
    • Edited by JoseKreif Monday, September 14, 2015 5:07 PM
    Monday, September 14, 2015 5:06 PM
  • Hi. Glad to hear you got it sorted out. Cheers!
    Monday, September 14, 2015 5:12 PM