Query Description in Forms?

  • Thread starter Thread starter shmoussa
  • Start date Start date
S

shmoussa

Hi, I have all of my queries listed in a drop down box. Is it possible
that when I select a query from the list to have the description (in
the Properties menu) show up automatically on the form?

Example- when I select Houses from the drop down menu, a designated
area on the form will say "Lists all local houses." This description
is taken from the object properties.

Can I do it? Help please. Thanks!
 
shmoussa said:
Hi, I have all of my queries listed in a drop down box. Is it possible
that when I select a query from the list to have the description (in
the Properties menu) show up automatically on the form?

Example- when I select Houses from the drop down menu, a designated
area on the form will say "Lists all local houses." This description
is taken from the object properties.

Can I do it? Help please. Thanks!

You need code like this in your listbox's AfterUpdate event procedure:

Me.TextboxName = CurrentDb.QueryDefs(Me.Listbox).Properties("Description")

(that should be all on one line)
 
You need code like this in your listbox's AfterUpdate event procedure:

Me.TextboxName = CurrentDb.QueryDefs(Me.Listbox).Properties("Description")

(that should be all on one line)

Thank you for your response. Is there a way to make it so that if
there is not a description for the query, it will say so in the
textboxname, rather than generating an error?
 
You need code like this in your listbox's AfterUpdate event procedure:

Me.TextboxName = CurrentDb.QueryDefs(Me.Listbox).Properties("Description")

(that should be all on one line)
Thank you for your response. Is there a way to make it so that if
there is not a description for the query, it will say so in the
textboxname, rather than generating an error?

Replace the code I posted previously with:

Dim tmp As String

On Error Resume Next
tmp = CurrentDb.QueryDefs(Me.Listbox).Properties("Description")
On Error GoTo 0
If tmp="" then tmp = "Property Not Set"
Me.TextboxName = tmp
 
Back
Top