Get Button Caption from query

DevRev

Registered User.
Local time
Today, 09:02
Joined
Mar 30, 2006
Messages
18
Hi,
I am kind of new to VBA so any help would be greatly appreciated. I am trying to set the captions of buttons on my form by running a query. Here's what I have so far.


Dim LSQL As String

'Display all customers
LSQL = "select LetterName from Letters where LetterID = 1"


Form_frmReportByInfo.RecordSource = LSQL

Command10.Caption = LSQL

So in other words I want the caption of Command10 to be the LetterName. I have multiple buttons and I want to set each one to be a different LetterName by running a query for each. Please advise.
 
I found my own answer.

This is what I used (in case anyone else runs into this).

Public Sub form_load()

Me.Command10.Caption = DLookup("LetterName", "Letters", "LetterID = 1")

End Sub
 

Users who are viewing this thread

Back
Top Bottom