在Microsoft Access 2013形式的消息框中显示选定的记录 [英] Display selected records on message box in the Form of Microsoft Access 2013

查看:79
本文介绍了在Microsoft Access 2013形式的消息框中显示选定的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS Access 2013中有一个表格.

I have a form in MS Access 2013.

输入信息后,选择零件并单击 SEND (发送)按钮,零件将被发送出去(插入表B中并从表A中删除).

After enter the information, select the parts and click the SEND button, parts will be sent out (insert into Table B and delete from Table A).

我想在零件发出之前在消息框中显示选定的记录.

I would like to display selected records on the message box before the parts sending out.

有可能吗?如果没有,您能为我推荐另一种方式吗?非常感谢你!

Is it possible? If not, could you please recommend another way for me? Thank you very much!

推荐答案

是的,有可能.我想数据存储在表中了吗?您可以在按钮的on click事件上使用vba,如下所示:

Yes, it is possible. I suppose the data is stored in a table? You can use vba on the on click event of the button as follows :

private sub buttonSend_onclick()
    Dim rs as recordset
    Dim s as string

    s = "Select * from [TableName] Where [SelectFieldName] = True"
    Set rs = Currentdb.openrecordset(s)
    s = ""
    While not rs.eof
        s = s & rs("[PartIdFieldName]") & ", "
        rs.movenext
    wend
    if s <> "" then
        s = left(s,len(s) - 2)
        s = s & "."
    else
        Msgbox "No parts selected"
    end if

    s = "Deliver parts below?" & vbcrlf & vbcrlf & s
    if(msgbox(s,vbYesNo) = vbYes) then
        ''proceed with the send
    else
        ''do not proceed with the send
    end if
end sub

这篇关于在Microsoft Access 2013形式的消息框中显示选定的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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