Display Query Result in a messagbox

pieterw

Registered User.
Local time
Today, 22:49
Joined
Apr 20, 2010
Messages
12
Hi guys

This should be a rather easy question, however my knowledge (and Google) dif not foresee a correct answer.

There is a form (frm_input) with a button 'SaveDocument'

this button executes an append query (works perfect)
after this query is executed, I want to display a messagebox with a result of (another) query
(this is the confirmation for the user that his document is saved, and returns the number assigned to his document)

this is what i have so far:

Private Sub SaveDocument_Click()
DoCmd.OpenQuery ("qry_append_to_tbl_SAP")
MsgBox ("Document .......... saved")
End Sub


The dots should be replaced with the query result (one field only)
this is the SQL for that query

SELECT Max(tbl_SAP.[Doc nr]) AS [MaxOfDoc nr]
FROM tbl_SAP;


how can i paste this query result in the messagebox?

thanks for any kind of help!
 
Use Dmax to pick up the single value
 
Like spikepl mentioned:
Code:
Msgbox "Document " & DMax("[Doc nr]", "tbl_SAP") & " saved."
 

Users who are viewing this thread

Back
Top Bottom