Results 1 to 5 of 5
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    Option in Form

    Hello all
    I've put a check box (yes / no)
    But when you open the form, this message appears

    Private Sub Form_AfterUpdate()
    If Me.Cach = "Yes" Then
    Me.HASPa = Me.Text29
    Me.AmountPa = Me.Text31


    ElseIf Me.Cach = "no" Then
    Me.HASPa = 0
    Me.AmountPa = 0
    End If
    End Sub
    Click image for larger version. 

Name:	ee.PNG 
Views:	9 
Size:	6.2 KB 
ID:	15741Click image for larger version. 

Name:	rtt.PNG 
Views:	9 
Size:	20.6 KB 
ID:	15742

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Since the Checkbox is tied to a Boolean Field, so you can't compare them to strings, like you've done, You can use True/False or 0/-1:

    Code:
    If Me.Cach = True Then
      Me.HASPa = Me.Text29
      Me.AmountPa = Me.Text31
    ElseIf Me.Cach = False Then
      Me.HASPa = 0
      Me.AmountPa = 0
    End If

    I'd also put this in the Cach_AfterUpdate event, rather the the Form_AfterUpdate event.

    Linq ;0)>

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    First of all, a checkbox does not have text value so "Yes" or "no" will not work.

    If Me.Cach = True

    or

    If Me.Cach = -1

    or

    If Me.Cach = False

    or

    If Me.Cach = 0
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much Miss and june
    Very good
    But the message still appears
    But there are other database I have not found where (Cach)
    Do not show me the error message
    Only when I add (Cach) Click image for larger version. 

Name:	qa.PNG 
Views:	7 
Size:	49.8 KB 
ID:	15744

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Do you have code in the form OnCurrent event? The error references that event.
    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. Unusal form option
    By buckwheat in forum Access
    Replies: 2
    Last Post: 08-27-2013, 06:57 AM
  2. Combo Box Wizard does not have option form option
    By CementCarver in forum Forms
    Replies: 5
    Last Post: 02-28-2013, 08:54 PM
  3. Replies: 6
    Last Post: 05-27-2012, 01:39 PM
  4. no option to import xls file or option all files
    By captgnvr in forum Import/Export Data
    Replies: 3
    Last Post: 09-22-2009, 10:19 AM
  5. option group in form
    By mawa4492 in forum Forms
    Replies: 1
    Last Post: 08-05-2009, 02:49 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