nataliek92
New Member
- Joined
- Oct 29, 2014
- Messages
- 40
Hi Everyone
Hoping this is a simple question - any help would be appreciated!
I would like to display a record in a message box but can't seem to find anything online to help me do this.
I am using MS VBA for Excel 2010. I would like a MsgBox to display the single result from this SQL string :
Currently, I have a full working code which extracts data and places it into a cell in my workbook. I know I could easily use this code then reference that cell in a MsgBox, but I'm quite fussy and like my reports to be nice and clean! Basically I would like a MsgBox to pop up containing the record. It's just for reference, so the user can see the value. Hopefully someone can help.... This is my working string which places the record into cell A1 on "MyPage".
In theory, I would like a code such as
but obviously this won't work.
Any advice?
Thank you in advance.
Hoping this is a simple question - any help would be appreciated!
I would like to display a record in a message box but can't seem to find anything online to help me do this.
I am using MS VBA for Excel 2010. I would like a MsgBox to display the single result from this SQL string :
Code:
str1 = "SELECT CAST(MIN(LoginDate) AS DATE) FROM AgentLoginTable"
Currently, I have a full working code which extracts data and places it into a cell in my workbook. I know I could easily use this code then reference that cell in a MsgBox, but I'm quite fussy and like my reports to be nice and clean! Basically I would like a MsgBox to pop up containing the record. It's just for reference, so the user can see the value. Hopefully someone can help.... This is my working string which places the record into cell A1 on "MyPage".
Code:
With rs1
.ActiveConnection = cnn1
.Open str1
Worksheets("MyPage").Range("A1").CopyFromRecordset rs1
.Close
End With
In theory, I would like a code such as
Code:
MsgBox.CopyfromRecordset rs1
Any advice?
Thank you in advance.