Results 1 to 5 of 5
  1. #1
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68

    problem to save numeric value

    Hi All.


    To save record I check form fields if they are empty or greater then zero.
    Code:
            If Len(Trim(Me.txtTicketNo)) > 0 Then
                !TicketNo = Me.txtTicketNo
            End If
    
    
            If Len(Trim(Me.txtAmount)) > 0 Then
                !Amount = Me.txtAmount
            End If
    Both txtTicketNo and txtAmount are numeric fields. But error message
    Click image for larger version. 

Name:	NumericFieldErr.png 
Views:	11 
Size:	4.7 KB 
ID:	46886
    popup only for line !TicketNo = Me.txtTicketNo. How to fix the problem?
    Thanks

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    To check if a number field is not empty and greater than zero you would use something like this:

    Code:
    If Nz(Me.txtYourNumberField,0) >0 Then 
        'do your stuff here
    End if
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Set a breakpoint on that line. What shows as value of txtTicketNo?
    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.

  4. #4
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68
    Thanks. I solved the problem by substitute numeric data type from Integer to Long Integer.

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,261
    Unbound forms appear to be the trend these days?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 6
    Last Post: 01-08-2016, 04:25 PM
  2. Replies: 11
    Last Post: 11-30-2015, 01:06 PM
  3. I have a Save/Continue Problem!!
    By Z1nkstar in forum Access
    Replies: 2
    Last Post: 11-25-2014, 12:02 PM
  4. save new record problem
    By msasan1367 in forum Access
    Replies: 11
    Last Post: 06-30-2013, 08:57 AM
  5. Automatic Numeric Problem
    By solty89 in forum Queries
    Replies: 3
    Last Post: 05-21-2013, 07:11 AM

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