Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    Ok, so it comes back with the first message if I open a blank form and hit save, if I put in a partnum and no manufacturer, I get the first message, but a record is saved to the table...


    If i put in both, I get the second message
    Does access perhaps save the record internally when calling the function? That's what appears to be happening as far as I can tell...


    Edit note - mis-typed in first try.

  2. #17
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    I suppose I could use validation at the table level... but I'd prefer to do it at the form level, if possible.

  3. #18
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    don't save any records to the table, just work with the message boxes/debug statements until you're getting the correct message.

    or attach a sample database with enough data to replicate the problem

  4. #19
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    Sorry if I wasn't clear... I'm getting the correct messages... the sub and function appear to work... it's just that I've now identified the real issue...

    I have 2 fields that are required, partnum and manufacturer...

    the problem appears to be that if I put data in just one of those fields Access saves the record before calling the function, thus writing an incomplete entry to the table even before the validation function runs.... if the user continues on and updates the fields then the record is updated, so that's not an issue... but if they get out of the form by some other means, I'll have an improper entry in my table...

    This database is a split database with over 100 forms, dozens of queries and dozens of tables... which I didn't design but am tasked with updating and maintaining... figuring out what I need to export to create a sample database that can replicate the issue is a little more than I'm able to commit to right now...
    I think for now I'll just leave the replicated code in the individual subs and not move it to a function, as this issue didn't occur until I did that... someday when I have time I may attempt to dig deeper on this...

    Thanks for all your help rpeare... if nothing else you've corrected my bad behavior on the string concatenation

    At this point, I've just spent too much time trying to fix something that's generally minor in the scope of this project and I simply have to move on, unresolved or not.

  5. #20
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    ahh ok, you must be using a bound form? Have you set an index on your table to require both fields? if you do that nothing will remain in the table without the required fields being present. I use unbound forms primarily for this reason, I want to control when/how data is accessed rather than having a partial or inaccurate record.

    You may also be able to issue an undo command to remove the unwanted record, you an also play around with the 'before update' property.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query not returning expected results
    By MarcieFess in forum Queries
    Replies: 3
    Last Post: 10-18-2013, 05:28 PM
  2. Replies: 3
    Last Post: 07-23-2013, 01:30 PM
  3. Query not returning all expected results
    By amenitytrust in forum Queries
    Replies: 6
    Last Post: 11-05-2012, 07:13 AM
  4. Syntax Error while calling sub: Expected: =
    By cowboy in forum Programming
    Replies: 3
    Last Post: 07-12-2010, 02:21 PM
  5. Calling a function and returning a value
    By 3dmgirl in forum Programming
    Replies: 0
    Last Post: 04-23-2007, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums