VBA code,检查所有记录的状态字段 [英] VBA code to check the status field of all records

查看:235
本文介绍了VBA code,检查所有记录的状态字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是遇到了一个问题,我的code我的一部分。我有一个命令按钮,当它是pressed这决定了它是星期几。在某一天它应该是检查状态字段和一个标有需要有序每条记录查询运行并打开。这工作得很好,除非是打开的最后一个记录标记不同(正常或排序)。我需要它无论怎样的最后一个记录打开被打成运行。 <一href="http://stackoverflow.com/questions/33056979/vba-$c$c-to-change-font-and-size-in-an-email-from-access/33061898#33061898">VBA code,从接入改变字体和大小在一封电子邮件中

 如果平日(NOW())= vbSunday然后
    如果窗体![管理员文件夹列表] .Status.Value =需要有序那
        DoCmd.OpenFormOrderForm
    结束如果
结束如果
 

解决方案

然后就离开了那个条件:

 昏暗RS作为DAO.Recordset
如果平日(日)= vbSunday然后
    设置RS = Me.RecordsetClone
    rs.FindFirst状态='&放大器; 需要有序和放大器; '
    如果rs.NoMatch = false,那么
        DoCmd.OpenFormOrderForm
    结束如果
结束如果
设置RS =什么
 

I just ran into a problem with my one part of my code. I have a command button that when it is pressed it determines what day of the week it is. On a certain day it is supposed to check the status field and for each record that is labeled "Needs Ordered" a query is run and is opened. This works fine unless the last record that was opened is marked different (OK or Ordered). I need it to run no matter how the last record opened was labeled. VBA Code to change font and size in an email from access

If Weekday(Now()) = vbSunday Then 
    If Forms![Admin Box List].Status.Value = "Needs Ordered" Then 
        DoCmd.OpenForm "OrderForm" 
    End If 
End If 

解决方案

Then just leave out that condition:

Dim rs As DAO.Recordset
If Weekday(Date) = vbSunday Then 
    Set rs = Me.RecordsetClone
    rs.FindFirst "Status = '" & "Needs Ordered" & "'"
    If rs.NoMatch = False Then
        DoCmd.OpenForm "OrderForm" 
    End If
End If 
Set rs = Nothing

这篇关于VBA code,检查所有记录的状态字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆