Display selected records on message box in the Form of Microsoft Access 2013

不想你离开。 提交于 2019-12-11 11:09:21

问题


I have a form in MS Access 2013.

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!


回答1:


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


来源:https://stackoverflow.com/questions/23887646/display-selected-records-on-message-box-in-the-form-of-microsoft-access-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!