Help/Error Messages

Howlsta

Vampire Slayer
Local time
Today, 16:00
Joined
Jul 18, 2001
Messages
180
I'm sure this is possible, how can I get an error msg to display values of specific fields. eg I would like to tell the user the name of a module and course that wasn't added

"this [modulename] is NOT on [coursename]"

as opposed to "this module is not on the course you selected"

anyone know how pls?
 
You can use the ampersand (&) to join text strings together. A typical example is:

“Hello “ & “World” is equivalent to “Hello World”

So, if this is a subroutine in a form and [modulename] and [coursename] are fields on that form whose values you want to use in your message box, you could do it like this:

msgbox "Module " & Me.modulename & " is not on " & Me.coursename

Or if the values for [modulename] and [coursename] are already stored in variables in the executing sub you could use those variable names in place of Me.FieldName. Hope this helps.

~Abby
 
So, it's the same as concatenating a name for instance in a query. What if I want to put the value of a cbo box in the msg?

I tried doing it like this:

msgbox "Module " & Me.cboStaff & " is not on " & Me.cboModule

but then of course I get the unique ID code (which is meaningless to the reader) for the values in the 2 controls. This is because ModuleID is the record source, although that is hidden in the cbo box just to leave the Module Title. Anybody know how I could get the Module Title in the msg for instance?
 
Hi Howslta,

you need to reference the column of your text box that contains the value you want to display, like me.cboModule.column(1) if your friendly display name is the second column in the box,

HTH

Drew
 

Users who are viewing this thread

Back
Top Bottom