chr function/msgbox

  • Thread starter Thread starter placek
  • Start date Start date
P

placek

Hi

I have a few problems that have been hurting my head for a
while. Your help would be much appreciated.

Question 1 - what chr function carries out a linefeed?
This old access 97 vba book i'm reading says chr(10), but
i dont see any linefeed when i use it on later versions of
access.

Question 2 - i have inserted a message box in my code
using the code 'msgbox("Insert a number",vbInformation)'.
Though when i press return after the closing parenthesis,
the following message comes up............
'Compile Error: Expected:='
I realise only the first argument is compulsory, so i cant
understand why this message is coming up. Please advise.

Thanks, Martin.
 
See inline ....

Hi

I have a few problems that have been hurting my head for a
while. Your help would be much appreciated.

Question 1 - what chr function carries out a linefeed?
This old access 97 vba book i'm reading says chr(10), but
i dont see any linefeed when i use it on later versions of
access.
Use vbCrLf
It is a visual basic constant for Carraige Return and Line Feed.
Question 2 - i have inserted a message box in my code
using the code 'msgbox("Insert a number",vbInformation)'.
Though when i press return after the closing parenthesis,
the following message comes up............
'Compile Error: Expected:='
I realise only the first argument is compulsory, so i cant
understand why this message is coming up. Please advise.
It's the parens. When you use parens something is expected to be
returned. Instead try ...
MsgBox "Insert a number",vbInformation



- Jim
 
1: chr(10) is a linefeed character. Whatever is
interpreting this charater is at liberty to ignore it.

2: There are two forms of msgbox, procedure and function.
You are using the function form.
The difference is in the use of parentheses.

the forms are

Function
x = msgbox("text", vbinformation, "Help") or
if msgbox("text", vbinformation, "Help") = X then

procedure
msgbox "text", vbinformation, "Help"

you are getting an error because you have used ("text",
vbinformation, "Help") without the =
 
Back
Top