Results 1 to 4 of 4
  1. #1
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124

    Dont Show Up In Table

    Hello
    Forum,



    I am using Microsoft Access 2016,.accdb, I am trying to create an inventory database for my department.
    Currently I only 1 form which is frmMaster and only Username: Ang Password:kiwi and maybe afew more can access it.

    I would like to not save/add records to table from frmLog when user enters invalid entry.

    Reason being, the information will be confusing when report is generated from frmLog.

    If there are any suggestions or help will be much appreciated.

    Yours Sincerely,
    Haziq
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Start with review of http://allenbrowne.com/AppInventory.html

    Please post the code you are having issue with and the errors encountered or otherwise explain why it does not do what you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124
    Dear,
    June

    I have read the article again and again to understand.

    I think I do get the idea.

    But I do not know how to implement.

    Could I just override the error value to 0 in frmLog?

    If so,
    how could I do it?

    I will update my database soon to use DSum()

    The code is:

    Option Compare Database
    Option Explicit




    Private Sub btnAddNewRecord_Click()


    Dim sSQL As String
    Dim nQty As Long
    nQty = DLookup("CurrentQty", "tblMaster1", "MasterIDPK=" & MasterIDFK)

    Select Case Withdraw

    Case True

    If nQty - UserQty > 0 Then

    sSQL = "UPDATE tblMaster1 Set CurrentQty = CurrentQty - " & [UserQty] & " WHERE MasterIDPK = " & [MasterIDFK]

    End If

    Case False

    sSQL = "UPDATE tblMaster1 Set CurrentQty = CurrentQty + " & [UserQty] & " WHERE MasterIDPK = " & [MasterIDFK]

    Case Else

    MsgBox "No action taken, 'Withdraw' does not contain a valid entry", vbOKOnly, " I N P U T N E E D E D "

    Exit Sub

    End Select

    If Len(sSQL) > 0 Then

    CurrentDb.Execute sSQL, dbFailOnError

    Else

    MsgBox "No action taken, check your quantities for valid values", vbOKOnly, " C H E C K QTY V A L U E S "

    DoCmd.Beep

    End If

    DoCmd.Close acForm, Me.Name


    End Sub
    Btw, how do I add code properly in this forum?

    TIA

    Haziq

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Use CODE tags, click the # icon then paste code between the tags.


    The point is to not update the table with current quantity. Build queries that calculate the balance when needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Dont show duplicate field values
    By Homegrownandy in forum Queries
    Replies: 5
    Last Post: 02-09-2017, 03:35 AM
  2. If one works, the other dont.
    By Vegaanders in forum Reports
    Replies: 2
    Last Post: 06-16-2016, 07:00 AM
  3. Replies: 12
    Last Post: 09-04-2013, 02:51 AM
  4. Replies: 7
    Last Post: 09-21-2012, 11:09 AM
  5. Dont show null fields in report
    By senna in forum Reports
    Replies: 4
    Last Post: 03-03-2011, 02:30 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