问题
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