Choose a specific option from combobox.

Shankar14

New member
Local time
Today, 06:38
Joined
Apr 6, 2022
Messages
7
Hello, I started using access recently and I am badly in need of help.

There are few data fields in a page and If I mark the first field as 'N/A', I want all the other fields to appear as 'N/A'. I was successful in that attempt of the fields with a "free text" property however, I am unable to get the 'N/A' for fields with a combobox option. The combobox has an option of 'N/A' in the list.

My question is how do I make a specific option appear while writing a IF..Then queries by choosing a specific option from combobox.

TIA.
 
Hi. Welcome to AWF!

You'll have to use the value that the combobox is expecting. For most comboboxes, that would be a number.
 
Hello,

Thanks for the response. I tried the number even then, I could not work it out.
If "Me.Text380" is written as 'N/A', I want all the other fields to be 'N/A' however "Me.Combo24.Value" is not being marked as N/A.

|I tried to code this as well. " SELECT [tbl2_SiteLkUp].[ID], [tbl2_SiteLkUp].[Site] FROM tbl2_SiteLkUp ORDER BY [Site]; ", no use.

1649327522284.png


1649327251934.png


Kindly help me.
 
Try:
Code:
Me.Combo24 = DlookUp("ID", "tbl2_SiteLkUp", "ID = 11")
or
Code:
Me.Combo24 = DlookUp("ID", "tbl2_SiteLkUp", "Site = 'N/A'")

My "two cents": Try to name the form objects intelligibly - otherwise you will get confused with them later
 
Last edited:
it is Unlikely that in the future you will change your tbl2_SiteLkUp table and
assign "N/A" to a different ID.
the reason is that if you do that, all historical record will now point to the wrong
Site. and you need to create an Update query just to update the "old" records.

you can assign it manually (unless the Bound column is not 1):

Private sub text380_afterupdate()
If me.text380 & "" = "N/A" then
Me.Combo24 = 11
End If
End Sub
 
I tried those 2 codes.. It didn't work. Can you let me know if I can get any other way
 
Hello, I started using access recently and I am badly in need of help.

There are few data fields in a page and If I mark the first field as 'N/A', I want all the other fields to appear as 'N/A'. I was successful in that attempt of the fields with a "free text" property however, I am unable to get the 'N/A' for fields with a combobox option. The combobox has an option of 'N/A' in the list.

My question is how do I make a specific option appear while writing a IF..Then queries by choosing a specific option from combobox.

TIA.
Try this, click on the link
Create a Combo Box That Allows a User to Select N/A
 

Users who are viewing this thread

Back
Top Bottom