Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Read only combobox in MS Access Forms

Posted on 2004-08-05
4
Medium Priority
?
666 Views
Last Modified: 2008-03-17
I have a combobox that is pulling pallet numbers from a pallet lookup table.

Once the user selects the pallet number from the combobox, it flags the pallet number from the pallet lookup table and sets it status as used.

The next user only sees available pallet numbers.

Here's my problem if they accidently select the combobox and delete the value listed they cannot select it again unless I reset the status to available.

I know in VB there is a drop down list that is read only. Access only has a drop down list for dataaccess pages.
What I want is once they have selected the correct pallet # then they cannot delete it from the text box area until they have finished scanning. The they click End Scan button and it resets the combobox with "".


Is there a solution to my problem in Access?
0
Comment
Question by:redcurl40
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:morpheus30
ID: 11731306
Have you tried basing the recordsource of the combo box on a query instead of a table?

"SELECT ID, Name FROM Pallett ORDER BY Name"
0
 

Author Comment

by:redcurl40
ID: 11731444
It is based on a query. How do I keep them from deleting the selected value if they go back into the combo box before I have reset it to "". Remember the value in the combobox drop down are gone once they have selected and confirmed that this is the correct pallet number.

So if they accidentally go back into the combobox for whatever reason and delete it, the number cannot be selected from the drop down.

So after they have selected the correct pallet number I want to locked the combobox until they have finished scanning that pallet. When they are done it then finalizes the scan and resets a text box and the combobox back to "".
0
 
LVL 5

Accepted Solution

by:
morpheus30 earned 1000 total points
ID: 11731575
Unfortunately you can't lock a combo box in Access.  But you could change how the combo box gets it's recordsource data.  Create a subroutine when you open the form to do the following:

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim sValues As String

Set db = CurrentProject.Connection
Set rs = New ADODB.Recordset

sSQL = "SELECT ID, Name FROM PalletTable ORDER BY Name"

rs.Open sSQL, db, 1, 1

rs.MoveFirst
Do Until rs.EOF
  sValues = sValues & rs(0) & ";" & rs(1) & ";"
  rs.MoveNext
Loop

rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

Me.ComboBoxName.ControlSource = ""
Me.ComboBoxName.ColumnCount = 2
Me.ComboBoxName.BoundColumn = 1
Me.ComboBoxName.RowSource = sValues
Me.ComboBoxName.RowSourceType = "Value List"
Me.ComboBoxName.Requery


0
 

Author Comment

by:redcurl40
ID: 11731886
I appreciate the multiple ways you've given me to populate the combobox, but it does not resolve my issue.

I did find a way to resolve my issue, which is to lock down the value of the combobox until they have finished scanning and click on the button End Scan which tests if they scanned all of the pieces.

I created a text box and made set it visible property to false. Placed it over the combobox.

When the user selects the pallet number they want, in the After Update Event of the combobox sets the following.

cboPalletNumber.visible = false
txtPalletNumber.enabled = false
txtPalletNumber.visible = true

Then if they cancel it reset those controls to their opposite states.

I tested it and it works.

I appreciate that you responded as fast as you did. This was a tough one to explain in a few words.

Thank you

Then the rest of my code runs as ususal. And they cannot change the value while scanning a pallet.


0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question