How do I run the same expression for different variables?

A

AMN

Hi,

I have an expression with two variables. I would like to write a code to
run the same expression with the different variables. Below is the example:

Variables "stX" and "Y"
Where "stX" is a string and "Y" is a field name in a different table.
I Have 10 sets of "stX" and "Y" combinations.

This is the expression I want to run:

Private Sub ImportMemo_Click
Dim stHeader As String
stX = DLookup ([Y], "Table", MRN = Me.MRN)
If Not stX = "" Then
stX = VbNewLine & stX
stHeader = "Title:"
Else
stX = " "
End If

If Not stHeader = "" Then
Me.Memo = stHeader & stX1 & stX2 &...& stX10
End If
End Sub

Your help is much appreciated.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top