Results 1 to 5 of 5
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Select All Records Where Void equals False

    I Need to select all records except those where Void is True, default is False. It is a value list set to True/False.
    If Void = True Then Do Not Print. Code to run before this! Printed = 1 unless Void is True Then Printed = 0 for that record. Void is a field on form with its control source set to Void. I know how to do this is a query but not in vba. The code is run from the form on a command button.

    Printed = 1
    If Me.Dirty Then Me.Dirty = False 'Force Save Record
    stDocName = "Checks"
    Forms!ContinuousBlankChecks.Visible = False


    DoCmd.OpenReport stDocName, acPreview
    Forms!BlankChecks.Visible = True
    __________________________________________________ ______________
    Here is what I am trying to make work by skipping the next record but maybe I have to do a loop or something, don't know!
    If Me.Void = True Then
    DoCmd.NavigateTo acCmdRecordsGoToNext

    Dim AddItemsAsInventorymsgbox As String

    AddItemsAsInventorymsgbox = MsgBox("Print ALL Checks?", vbInformation + vbYesNo, "ContinuousBlankChecks")

    If (AddItemsAsInventorymsgbox = vbYes) Then
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSelectAllRecords
    Me.Printed = 1
    DoCmd.SetWarnings True
    DoCmd.Save
    If Me.Dirty Then Me.Dirty = False 'Forces a Save Record.
    Me.Requery
    End If
    Attached Thumbnails Attached Thumbnails VoidCheck.jpg  
    Last edited by burrina; 12-22-2012 at 10:46 PM. Reason: Trying Code

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Not understanding. Select records from where? I don't see a field in the subform list of checks called Void. What do you mean by 'value list'? Where is the variable Printed used? Why setting visibility of forms?
    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
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I am using a Label to Set the Status to Void.My value list is used for the Void control itself which is not visible on the form. The Print variable is used when you need to print a single check or a batch of them.Thereby skipping any records where they are Voided, i.e. Void = True
    Right now trying just enabling and disabling all controls, don't know how else to do it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    If you want code to read each record of the subform then yes will need loop structure. Also, I would use a RecordsetClone, easier to detect when the end of the records encountered.

    With Me.subformname.Form.RecordsetClone
    While Not .EOF
    'code to do something with record
    .Next
    Wend
    End With
    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.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Thanks, I will give that a try

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

Similar Threads

  1. Unbound text box equals two conjoined fields
    By brharrii in forum Reports
    Replies: 1
    Last Post: 10-23-2012, 04:26 PM
  2. Return rows where value equals drop down
    By AccessLiability in forum Forms
    Replies: 1
    Last Post: 07-02-2012, 07:15 AM
  3. Replies: 8
    Last Post: 03-18-2012, 11:17 AM
  4. SELECT "False" if any records are false?
    By Azurewrath in forum Queries
    Replies: 6
    Last Post: 12-21-2011, 03:36 PM
  5. Is the Access 'Equals' operator broken?
    By AccessPonderer in forum Queries
    Replies: 0
    Last Post: 03-18-2011, 09:00 AM

Tags for this Thread

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