×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Default Value for ComboBox

Default Value for ComboBox

Default Value for ComboBox

(OP)
Hi

I dont know if this can be done with comboboxes. I have a ComboBox on a form set to use formula for choices with the choice being "@DbColumn("":"RECACHE";"":"";"staff";1)"

When the form loads the DBcolumn pulls back the fields, but i would like to have a default value set at the top of the list.

for example the combobox would just say something like "please select" and when you select it will then show all the values from the DBcolumn lookup.

If any one knows how/if this can be done it would be much appreciated

Many thanks

RE: Default Value for ComboBox

Put the list in a temporary variable, and insert your default value first in the list.

Pascal.

RE: Default Value for ComboBox

(OP)
Sorry Pascal i dont really understand, i had a look in the help guide and understand the syntax is variableName := value, but i havent a clue where to start. Could you Elaborate further for me.

When you say list do you mean the lookup formual "@DbColumn("":"RECACHE";"":"";"staff";1)?,

Sorry for my naivety

many thanks

RE: Default Value for ComboBox

I don't mean to be naive, but could you not just type "Please Select" in the DefaultValue section of the field, and then still use the lookup?

What pascal means is to do something like this:

tmplist := "Please Select" : @DbColumn("":"RECACHE";"":"";"staff";1)

(I've not tried this, it might need tweaking!)

RE: Default Value for ComboBox

(OP)
Thanks Fishkake, but I already tried the same way as you suggested but it did not work.

any other ideas?

Many thanks

RE: Default Value for ComboBox

(OP)
HI,

I got it to work by doing the following:

Completed_By:="";"Please Select":@DbColumn("":"RECACHE";"":"";"staff";1)

(Completed_By was my ComboBox field)

But i just got lucky trying different things. I dont understand why i couldnt just have:

Completed_By:= "Please Select":@DbColumn("":"RECACHE";"":"";"staff";1)

Instead of having to put Completed_By:="";"Please Select":@DbColumn("":"RECACHE";"":"";"staff";1)

Any one know why?

Oh well, at least it works. thanks guys!


RE: Default Value for ComboBox

I'm confused... Is this formula in the "Use formula for choices" section of the field?

What you're doing there is setting the variable Completed_By to "", and then specifying a list of options made up of "Please Select" and the DbColumn. A semicolon simply ends the declaration of the variable, the same as putting:

Completed_By:="";

"Please Select":@DbColumn("":"RECACHE";"":"";"staff";1)

If I'm right, and if this is the case, then the first part doesn't actually do anything! All you need is the second line, inside the "Use Formula for choices" section.

RE: Default Value for ComboBox

(OP)
Yes i am using the "Use formula for choices" section.
I have just done what you said, i used:

"Please Select":@DbColumn("":"RECACHE";"":"";"staff";1)

And this works fine, just the same.

So there was no need for a Temp Variable after all!

What is the colon : that separates "Please Select" & @DbColumn("":"RECACHE";"":"";"staff";1) actually saying?

many thanks for you help.

RE: Default Value for ComboBox

A colon seperates two values in a list. If you choose "List choices (one per line)" and type in the following:

Fish
Eggs
Cheese
Milk

Its the same as choosing "Use formula for choices" and typing this:

"Fish":"Eggs":"Cheese":"Milk"

The @DbColumn returns a list taken from the view column, and you are saying "make a list of 'please select' and the list returned by this function". Does this make sense?

As Pascal will tell you, I've wrestles with lists in the past, starting to get the hang of them now!!

RE: Default Value for ComboBox

(OP)
Yeah that makes perfect sense thanks. I was initially trying to make please selet a default value but by using the list method it dose a better job for me anyway.

Many thanks for your help and time in explaining it to me.

You learn something new every day!

cheers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close