ComboBox or Textbox

s9y

Registered User.
Local time
Today, 13:58
Joined
Mar 21, 2013
Messages
23
Hello Everyone,

I need help with my attached db. Currently everything is working great but i need to make some changes where user should not see the drop-down lists and instead of selecting their names from the list, they must scan it in. Just trying to put more control on.

* if the drop-down can be locked that'll be great but if i have to change it to textbox then how will the programming work?

please help me with this.

Thanks
Sunny
 

Attachments

EmployeeID.Locked = true - Locks the combo box.
EmployeeID.Visible = False - Hides the combo box.


Dale
 
I cannot open your file version (I'm running 2007) but if the Combobox is currently Bound to a Field in the underlying Table, and you have code in the AfterUpdate event of the Combobox, to do whatever, there will probably be no need to change your code. My understanding is that scanning data in to a Control is considered to be physically entering data, and the AfterUpdate event should still execute after the scanning is done.

To change the Combobox to a Textbox, in Form Design View
  • Right-Click on the Combobox
  • Click on Change To
  • Click on Textbox
If your code is not in the AfterUpdate event, or if the scenario is different from my above assumptions, let us know.

Linq ;0)>
 
Thanks rzw0wr, but i don't want to lock it as i still want the user input when they try to check out any equipment and same as checking-in. And certainly want it to be visible.


Missinglinq - Converting this combobox to a textbox is not working, not sure why but it';s just not. Maybe because i have a table linked with the combobox (Employee_ID) as it's source to get all the Employee name data. You are right that scanning data is as same as entering data manually. I wish if you could see the code and the relationships in there!!
 
* if the drop-down can be locked that'll be great but if i have to change it to textbox then how will the programming work?



Confused

:confused:

Dale
 
...Maybe because i have a table linked with the combobox (Employee_ID) as it's source to get all the Employee name data...
With you considering changing the Combobox to a Textbox, I never conceived that you had more than one column in the Combobox! There's no way that I know of doing that kind of conversion with a multi-column cbo.

Like Dale, I'm now confused as to your needs, here! You want a Combobox but you don't want the users to be able to use it? Or you simply don't want them to see anything in the dropdown except the names? You could do that by setting the column widths for those columns to zero.

If you just want the users to be able to enter/scan a name, in a Textbox, you can pull the other employee data, if that's what you were previously using the cbo for, by using DLookups in the AfterUpdate event of the Textbox.

If you need something else, here, you need to let us know with a clearer explanation.

Linq ;0)>
 
Thank you both for the suggestions and i apologize for not doing a good job on explaining.

let me take another shot on this: - Currently users are selecting their names from the drop-down menu and then check out a scan-gun and a printer. When the same user comes back to check-in the equipment, all they have to do is select their name and whatever number of equipment they checked-out earlier will show in drop-down menu of scan_gun_in and Printer_in. This is working fine but the problem is employees are just checking-in equipment's systematically even when they don't have it physically because this DB is letting them know which equipment they had checked out.

So just to put more control and to avoid any other employee checking-in or out equipments under different employees i need to put more controls such as giving a unique scanable ID to each employee to make them more accountable.

Don't have much experience with access and someone helped me in this DB as well so just trying my best to see you guys can help to make it possible.

Thanks again,
Sunny
 
Hi Sy9,

Just to clarify.

You have a barcode scanner attached to your PC and each item of equipment has a barcode attached to it and each employee also has a barcode on a badge or whatever.

What you want to be able to do is:

1. instead of users selecting themselves from the EmployeeID dropdown list they scan the barcode on their badge

and possibly?

2. instead of users selecting equipment from the in/out combo boxes they scan the equipment barcode
 
Hi CJ,

Thanks for the quick reply.

Yes, exactly what i want but is there a way i can prevent them from selecting it manually from the drop-down list?

Also how can i edit the code where employees must scan-in their equipment. In other words, they shouldn't see what was checked under their name in the first place (just to held them more accountable for the equipment)


s9y
 
Yes - this may not be the best way but makes best use of the form and tables as currently constructed
  1. Ensure the user barcode is coded with the userid from the employee table -60, 61 etc (note:I'm assuming the barcode can be coded as such)
  2. Add a new text control called BCode and in the BCode label caption put 'Click here and scan' or similar. Suggest placing it above the combo box, but up to you. The width of the control does not need to be wide - the user won't see anything but it needs to be big enough to click on
  3. Change the BCode forecolor to white so the text cannot be seen (you can do this after testing)
  4. In the BCode On Enter event put
    Code:
    Bcode=""
  5. In the BCode On Change event put
    Code:
    DoCmd.GoToControl ("Employee_ID")
  6. Change the locked property of the combo to true
  7. Change the combo control source to *
    Code:
    =[BCode]
To use, the user clicks on the Bcode control and then scans the barcode and then clicks on what they want to scan in or out.

To emulate a barcode scanner if one is not attached during testing, type the employee number somewhere else (e.g notepad) then copy and paste into BCode

*Sometimes barcode results contain other information like a date etc. If so, you will need to modify the combo controlsource referred to in 7 - so for example if the code is 0101201360 where the first 8 digits refer to the date the controlsource would become =right([Bcode],2)

Alternatively if you cannot assign a number to the barcode, you will need to determine it for each employee and create a new field in the employee table to record it - then some detailed changes to the form will be required - but we'll cover that if the above doesn't work for you.
 
Thank you CJ,

I'm gonna try this now and let you know how it went !!!
 
CJ,

So the textbox (BCode) is working to EmployeeID but the scan_gun_out and Printer_out are disabled and scan_gun_in and printer_in are enabled.

how can change that to like it was before?

please see attached.
 

Attachments

My mistake, please make the following changes

1. Restore the controlsource of the combobox to Employee_ID (i.e. replace =[BCode])
2. In the BCode On change event, replace code with
Code:
Employee_ID.Value = BCode.Text
Employee_ID_AfterUpdate

Was working on it quite late:)
 
Thank you CJ, it's working :)

Now lol

You suggested to use =Right in your previous post, i tried but that didn't worked. Is the code gonna go to somewhere else in combo box ?? It's a really good idea and i want to use it.


Also, can i apply the same concept of adding text boxes to the other fields such as scan_gun_out or printer_out as well? Ofcourse i tried simply but didn't worked.


I'm pretty sure you are very busy and i appreciate all your help !!!


Thanks
Sunny
 
You suggested to use =Right in your previous post

This depends on the value the barcode is producing - if it has been set to produce just the employee_id then that is fine, however if it produces a different value which includes the employee_ID you need to use string functions Left, Right, Mid as required to return just the employee_id - per my example in that post.

Also, can i apply the same concept of adding text boxes to the other fields such as scan_gun_out or printer_out as well?
Yes - it will be exactly the same principle. the text box will have a different name, the after update event will be similar but referring to the correct controls
 
I've tried using the =MID function in the Employee_ID combo box Control Source, but it didn't worked. The employee id is 100 and the whole scannable id is VFI100LCN. So i used =Mid([BCode],4,3) in Employee_ID control source but it gave me run-time error om "Employee_ID.Value = BCode.Text" that i can't assign the value.


where i'm wrong?
 
You need to refer to post #13

Employee_ID.Value =Mid([BCode.text],4,3)
Employee_ID_AfterUpdate
 
Works great, thanks !!

Is there also a simple code to refresh the form after some time so when the next employee uses the form, its all blank? right now when an employee checks something out, his/her name stays in the Employee_ID combo-box.

I've tried the form.timeinterval = 300000 and
form_timer to docmd.requery and me.refresh

but that only refreshes the BCode textbox but not the EmployeeID combo-box and scan_gun_out and printer_out combo-boxes stay enabled as to disabled.
 
In the form timer you need to have

Employee_id=0
me.timer=0

And in the BCode afterupdate event

me.timer=30000 '1000=1 second so 30000=30 seconds
 
Hey CJ,

Thanks for all the help with this DB.


But i think i have to start from scratch again. These combo-boxes are just killing me. Have to go with something where an employee has to scan in and out everything manually (no drop-down lists) to ensure the integrity of the process. People get very creative and somehow find the way to work around the system.

Got any suggestions for me?
 

Users who are viewing this thread

Back
Top Bottom