To chage the string of the Message Box

F

Frank Situmorang

Hello,

I was told the following query, and it works good. How can I change the
Notes By to be a Msg String : "Dicatat Oleh". I want it as a variable,
because i have already the table of String message, so that it can be in many
languages.

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes )
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & [Note by]
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;

Thanks in advance for many helps.
 
D

Douglas J. Steele

Are you talking about a stored query that you're trying to run, or are you
building the SQL dynamically in VBA?

For a stored query, you cannot refer to a variable. Your options would be to
refer to a control on an open form, or write a function that returns the
value of the variable. However, from your message it sounds like you
actually want to set it to a constant value, which can be done:

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes )
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & "Dicatat
Oleh"
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;

To refer to a control MyControl on a form MyForm, you'd use

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes )
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & " " &
Forms!MyForm!MyControl
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;

If you've written a function MyFunction that returns the value of the
variable, you'd use

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes )
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & " " &
MyFunction()
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;

If you're building the SQL in VBA code, you'd use

strSQL = "INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, " & _
"WKTCATAT, Subject, Notes ) SELECT a.NO_URTANGT, " & _
"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' ' & '" & _
MyVariable & "' " & _
"FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;"

Exagerated for clarity, that's

"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' ' & ' " & _
MyVariable & " ' " & _

although you could get away with

"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' " & _
MyVariable & "' " & _
 
F

Frank Situmorang

I think this is a stored query ( query that I have on my list of query in the database windows). But I want the word "Note by" can be changed according to the language. My software is capable of making it many languages. I have the Form Label table. Aslo the Message Strings table.

Thanks for your enlighting.

Frank



Douglas J. Steele wrote:

Are you talking about a stored query that you are trying to run, or are
25-Jan-10

Are you talking about a stored query that you are trying to run, or are yo
building the SQL dynamically in VBA

For a stored query, you cannot refer to a variable. Your options would be t
refer to a control on an open form, or write a function that returns th
value of the variable. However, from your message it sounds like yo
actually want to set it to a constant value, which can be done

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & "Dicata
Oleh
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a

To refer to a control MyControl on a form MyForm, you would us

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & " "
Forms!MyForm!MyContro
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a

If you have written a function MyFunction that returns the value of th
variable, you would us

INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, WKTCATAT, Subject, Notes
SELECT a.NO_URTANGT, a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & " "
MyFunction(
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a

If you are building the SQL in VBA code, you would us

strSQL = "INSERT INTO Catatan ( NO_URTANGT, TGLCATATAN, " &
"WKTCATAT, Subject, Notes ) SELECT a.NO_URTANGT, " &
"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' ' & '" &
MyVariable & "' " &
"FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].Catatan AS a;

Exagerated for clarity, that i

"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' ' & ' " &
MyVariable & " ' " &

although you could get away wit

"a.TGLCATATAN, a.WKTCATAT, a.Subject, a.Notes & ' " &
MyVariable & "' " &

-
Doug Steele, Microsoft Access MV
http://www.AccessMVP.com/DJSteel
(no e-mails, please!)

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Bar Graph With ASP And No Components
http://www.eggheadcafe.com/tutorial...9-60eb835185fa/bar-graph-with-asp-and-no.aspx
 

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