Stop entry data to my combo box!

J

John W. Vinson

Can I stop data being entered into a combo box on my form, but can change
the selections in it from my query
Thanks for any help.......Bob

Please explain. You can't "enter data into a combo box"!

A combo *takes* data from its Rowsource - typically a query, though it can be
a table or a list of values; and *puts* the selected value into its Control
Source, typically a field in the Recordsource of the form on which the combo
is found, or it can be blank. You would use the blank unbound combo if the
purpose of the combo is to *find* a record or do something else with it,
rather than updating a field in your table.
 
T

Tom van Stiphout

On Mon, 24 Mar 2008 19:15:05 -0600, John W. Vinson

But only if LimitToList is true. For the OP perhaps it is not.
-Tom.
 
J

John W. Vinson

Hm. Well, that would enter data into the Form's Recordsource (irrespective of
the combo), but unless the combo were itself based on the same table and field
as its control source, that wouldn't enter info *into the combo*.

I hope Bob will post back and explain the question a bit more clearly!
 
J

John W. Vinson

I'm sorry, Bob, this is just Greek to me. You're assuming that I know a lot
more about your application than I do. I have NO way to tell what
qryOverdueMessage is or does; what orange backgrounds have to do with
anything; what trouble you're having (error messages, behavior); what any of
this has to do with "enter data into a combo box".

Could you slow down and explain it in a way that someone unfamiliar with your
database could a) understand what you have done - e.g. post the SQL of
qryOverdueMessage; b) the nature of the conditional formatting you're using;
c) what you're trying to get, with examples; and d) what you're actually
getting instead?
 
B

Bob Vance

Can I stop data being entered into a combo box on my form, but can change
the selections in it from my query
Thanks for any help.......Bob
 
S

sandrao

Can I stop data being entered into a combo box on my form, but can change
the selections in it from my query
Thanks for any help.......Bob

If you already have the information needed in your query and all you
want to do it stop someone entering info that is not selected try
Locking that field.
 
T

Tom van Stiphout

Just like John I've been trying to follow what you are doing. A few
points:
1: The DLookup on your report is wrong. It needs a WHERE clause.

2: You want a blank row in your combobox. I am assuming you don't have
that yet because in a good db design OverdueRemarks is a required
field so cannot be null. You can add a blank row by using a UNION
statement with another table that has just a single blank record:
SELECT OverdueRemarks
FROM tblOverdueRemarks
UNION
Select SomeField
From SomeTable
I often use a bit more elaborate SomeTable where I have a blank row,
but perhaps also one with dashes or "--Select your Remark--" or other
entries. I can pick up the row I want with a where-clause (...where
SomeFieldID = 5).

3: Not sure why you're not working with ID values; a typical dropdown
is bound to a 2-column query with RemarkID, Remark, and the first
column is the bound column and it is hidden. The values are saved to
an RemarkID field in your main table (the one bound to the main form
that the combobox is on).

4: We could leave the conditional formatting out of this for now;
that's just eye candy we can add when everything else works properly.

-Tom.

My Combo Box has a row source from this query
SELECT tblOverdueRemarks.OverdueRemarks
FROM tblOverdueRemarks;
My Combo box controls a text box on my Report :
=DLookUp("OverdueRemarks","tblOverdueRemarks")
Another form adds Remarks into the tblOverdueRemarks
but I am wanting to get a blank row in my combo so I have the option not to
Print any Remark
I have an Format Conditional Formatting : Expression Is : Not
IsNull([OverdueRemarks]) (Orange Colour)
Basically I'm wanting a blank row in my Combo so as I don't have to print
anything and conational Formatting will be normal
Thanks for the help........Bob
 
B

Bob Vance

I have a continuous form that has records of Overdue remarks that I can
select for only printing purpose on a Report Statement, when I select my
Client I can also select a message from another combo box to print on my
Statement, this combo box has a record source
=DLookUp("OverdueRemarks","tblOverdueRemarks")
and I don't want to able to change any data or add any data from this form
but from only the DLookUp
Thanks for any help...............Bob
 
B

Bob Vance

Oops Sorry the row source is a query qryOverdueMessage
Sorry thanks for the help...Bob
 
B

Bob Vance

Actually what am trying to achieve is that I can always select a blank
row/record so as nothing will print if I choose and my Conditional format
which is if there is any data in my combo box to show an orange back ground
as a warning that something is going to print. But having trouble trying to
find a blank row/record so as nothing will print and the combo box will turn
back to white back ground................Thanks Bob
 
B

Bob Vance

My Combo Box has a row source from this query
SELECT tblOverdueRemarks.OverdueRemarks
FROM tblOverdueRemarks;
My Combo box controls a text box on my Report :
=DLookUp("OverdueRemarks","tblOverdueRemarks")
Another form adds Remarks into the tblOverdueRemarks
but I am wanting to get a blank row in my combo so I have the option not to
Print any Remark
I have an Format Conditional Formatting : Expression Is : Not
IsNull([OverdueRemarks]) (Orange Colour)
Basically I'm wanting a blank row in my Combo so as I don't have to print
anything and conational Formatting will be normal
Thanks for the help........Bob
 
B

Bob Vance

Got around my combo box problem bt creating a control next to it with this
code, and now I have have the option to print nothing on my Report
Thanks Bob :)
 
B

Bob Vance

Oops forgot to enter code :blush:
Private Sub cmdClearMessage_Click()
cmbSMessage = ""
Me.Refresh
End Sub

Bob Vance said:
Got around my combo box problem bt creating a control next to it with this
code, and now I have have the option to print nothing on my Report
Thanks Bob :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top