Page 4 of 4 FirstFirst 1234
Results 46 to 48 of 48
  1. #46
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Quote Originally Posted by Ajax View Post
    No. It should look something like

    Attachment 29164



    Absolutely not. Backend contains all tables, nothing else. And is stored in a mutually convenient folder for all users on the network. Front end contains everything else. Each user has their own copy of the front end linked to the backend. They do not share it otherwise there is risk of corruption.
    Thanks Ajax for all your help!

    I've been testing the forms and it works well except there can be one a little user problem that can be encountered. That is when the user selects "NCR" then "NCR" vice versa, the form
    will dmax the next number on that form. I want to prevent this so I only allowed Me.Newrecords = true. The code looks like this below:

    Private Sub Form_BeforeUpdate(Cancel As Integer)


    If Me.NewRecord = True Then
    Me.NCRNumber = Nz(DMax("[NCRNumber]", "tblNCR", "[NType]='" & NType & "'"), 0) + 1
    End If

    End Sub

    Now.. this works well except if I change "NCR to "CDR" on an old record, it will not read the dmax of "CDR" because it's not a new record. What code can I add to error-proof the "NCR" to "NCR" dmax or "NCR" to "CDR" vice versa dmax.

    Thanks!

  2. #47
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    suggest once the record has been saved, you disable the controls

    in the form current event

    me.nType.enabled=me.NewRecord

  3. #48
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by raychow22 View Post
    <snip>
    Now.. this works well except if I change "NCR to "CDR" on an old record, it will not read the dmax of "CDR" because it's not a new record.
    No, it won't read dmax of "CDR" because the "CDR" records are in a different table. If you change "NCR" to "CDR", you will have to have code to append the record to the "CDR" table, get the new DMax number Then delete the record from the "NCR" table.


    Quote Originally Posted by raychow22 View Post
    <snip>
    What code can I add to error-proof the "NCR" to "NCR" dmax or "NCR" to "CDR" vice versa dmax.
    If both types of records were in the same table (both tables have the same structure), it would be a lot easier to code.

    I would also get rid of all of the Look up FIELDS.

Page 4 of 4 FirstFirst 1234
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 12-25-2015, 12:47 AM
  2. DMAx Question for Report - DMax <= Dtae
    By crimedog in forum Access
    Replies: 8
    Last Post: 12-29-2014, 09:31 PM
  3. Replies: 4
    Last Post: 05-08-2014, 11:46 AM
  4. DMax with LIKE in criteria
    By tylerg11 in forum Access
    Replies: 5
    Last Post: 07-26-2013, 10:39 AM
  5. Replies: 6
    Last Post: 07-24-2012, 03:02 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