Well, that became .0007, and the default text did show up! However, now after the name of the doctor is chosen from the list part, the top shows the id instead of the name.
If the ID field is the first column (column 0) it shouldn't be visible with a width close to zero.
I explained how to make the default text grey in post #13.
Have you read my web article? If not, please do so.
To get grey prompt text for this example, first set the control forecolor to grey, then the format property could be: [Black]@;"Enter Last Name"
The prompt text will be grey but the text entered by the user will be black
Nope. I wasn't sure what it was addressing because it spoke of color. I see the part you were referring to now though.
I may try this later, but for right now, i got it working on three comboboxes and i'm not sure i want to keep trying to redo it when it is already working perfectly. Then again, this seems cleaner, if a bit confusing.
The default colour needs to be grey because that is what you see before entering any text.
The format property e.g. [Black]@;"Enter Last Name" tells you what colour entered text will be (black) and gives the value when nothing is entered (Enter Last Name)
I suggested you read that article for a reason - it explains the format property of each datatype
You could at least do me the courtesy of spending a few minutes reading that to understand the ideas behind this approach.
Then it might be less confusing to you
You could at least do me the courtesy of spending a few minutes reading that to understand the ideas behind this approach.
Then it might be less confusing to you
I indeed did skim the article. I logged out of work for the day, so i didn't feel like going to in depth right now.
By "confusing" i did not mean it was hard to understand, rather, that it is backwards, in that the forecolor refers to the default, and the color specified by the default is the main color. Looking at that while not familiar with this behavior would likely confuse anyone until they read about the bahavior.
format property is usually one of the drums I bang
@chacham What Colin is saying for it to work in a combo is the bound column needs to be the first visible column (i.e the one that shows when the dropdown is closed). Doesn't matter whether the controlsource is populated or not.
In your case, you may need to bind to the hidden PK so the format option won't work unless you can do the following
1. leave the controlsource blank - as you have in post#22
2. set the bound column to column 2 - you have column1 in post#22
3. in the combo after update event some code along the lines of
Code:
me.DoctorFK=cboDoctor.column(0)
or perhaps you just need to make a change to building your filter/criteria (i.e. include .column(0))
4. if the control is bound you will also need some code in the form current event to set a value - along the lines of
cboDoctor=dlookup("DocName","tblDoctors","DoctorPK=" & me.doctorFK)
Note this won't work in a continuous form if the combo is in the detail section
format property is usually one of the drums I bang
@chacham What Colin is saying for it to work in a combo is the bound column needs to be the first visible column (i.e the one that shows when the dropdown is closed). Doesn't matter whether the controlsource is populated or not.
In your case, you may need to bind to the hidden PK so the format option won't work unless you can do the following
1. leave the controlsource blank - as you have in post#22
2. set the bound column to column 2 - you have column1 in post#22
3. in the combo after update event some code along the lines of
Code:
me.DoctorFK=cboDoctor.column(0)
or perhaps you just need to make a change to building your filter/criteria (i.e. include .column(0))
4. if the control is bound you will also need some code in the form current event to set a value - along the lines of
cboDoctor=dlookup("DocName","tblDoctors","DoctorPK=" & me.doctorFK)
Note this won't work in a continuous form if the combo is in the detail section
Either mine or colins . You haven’t provided any context around this and the other combo’s you want to provide the same functionality- are they for searching/ filtering? Populating a record? Criteria for opening a form?
@CJ_London, i'm sure your solution works, but i feel that my solution is easier. There's just so many steps in your solution. @isladogs solution seems more elegant, but, as i said, it seems confusing, and i already have something working. If i revisit this, i would likely try his solution again, even though it failed the first time around.
>are they for searching/ filtering? Populating a record? Criteria for opening a form?
The form is based on a query that refers to the two comboboxes, to which i added a third. When a selection is made, the form is refreshed so that the records in the form reflect the chosen facility, doctor, or now a third choice, patient.
Because i'm quite the newb here, and beginning to work on someone else's project. I'm asking to make sure i'm not doing something stupid. Also, even solutions i don't take still teach me useful things!
I appreciate the comments! I also like to discuss and understand the pros and cons of the different methods. And, who knows, when i present it to the user tomorrow (this change is mostly for just one user right now), things might go wrong, and i might end up using your solution instead.
Yes, i do need to add code. But, the form already had code in the afterupdate events, so it was pretty easy to add another line or two.