Validation against to database - sql-server

I have several textboxes and users are entering same data in one of these fields. I have another table which is store machine_no. I would like to restrict user for possible wrong entries. Example if there is no machine_no #4 on table, user will be warn with message box.
Machine_no Value1 In first day
1 500
2 400
3 600
Machine_no Value1 second day
1 8678
2 45645
3 54645
Thanks in advance

If you really want to restrict the available choices, I'd replace the free form textbox with a dropdown list of choices populated from your table.

You could use a NumericUpDown control to let the user enter only integers and validate against a generic List of integers or an array of integers (you can load the list with the existing machine numbers on your data base table), and finally you can use ErrorProvider control to show a warning to the user if enters a not valid number.

Related

what am i supposed to do in this situation?

so recently my principal is having me create a database for a tardy system recently what i've done is set up a google form where the student id can be enter through a num pad and put into a google sheet where ive setup 2 sheets one where it shows the student name and how many tardies they have and then the other is the google form responses, each tardies cell in the other sheet has the formula: =COUNTIF('Form Responses'!B:B,"") which essentialy checks the number of times a certain student id pops up, by ferpa i am not legally allowed access to the student id's is there any possible way i can maked it when a person enters their student id it adds/creates a new formula for the tardies cells to check through the entire list without a duplication or error code?
i have tried the =COUNTIF('Form Responses'!B:B,"") formula but that would make where my principal would have to edit a thousand lines of formula
Depending on the exact setup of your sheets, you can use a formula like this, guessing that the students' IDs are in A column:
=BYROW(A2:A,LAMBDA(each,IF(each="","",COUNTIF('Form Responses'!B:B,each))))
That would set a formula will drag all the column automatically.
Or, instead of having a list of IDs you can set a QUERY that will find all the ID values in the responses and their count:
=QUERY('Form Responses'!B:B,"SELECT B,Count(B) where B is not null group by B")

Populate dependent combox with Unique values VBA excel

I have created a user form for adding inventory.
I have 2 combobox in the form
Category = combobox1 (housekeeping, Electricals, Cafetria etc) for these categories I am populating combox1 with rowsource property
Itemsname - combobox2 - I want to populate this combobox based on the category selected in combobox 1
The problem I am facing is the items name repeat if there are more than 1 itemsname then all items name show up in the combobox2 which i dont want. I want to see unique values. I will give you example of entries
ColumnA(Category) ColumnB(itemsname) ColumnC (Vendorname)
Cafeteria Beans Cafe Coffee Day
Housekeeping liquid soap Sevak Industries
IT Monitors Infotech solutions
IT Keyboard Infotech solutions
IT Monitors Raj computers
see screenshot the above columns gets messed up : https://prnt.sc/10cbh30
Now in the above example I populate categories combobox 1 with unique values because number of categories are fixed so I have saved them separately and I pick them with rowsource
The main problem arises when I populate combobox 2 with items name. Same Item can be bought from different vendors so Monitors we are buying from different vendors so there are two entries. In combox 2 I see 2 entries of monitors but I want to see only one since the name is same.
Note I am using for loop and adding items in the loop in combobox 2 so it scans each entries of monitor twice so it adds up monitor twice
Can anyone help on this I am frustrated I cant figure out how to get unique values

Adding Autocomplete or typehead feature to ComboBox in Access 2016

I have an Access table that has about 500,000 records. I want to trim down the results as I type text into the ComboBox. Basically, I need a dynamic ComboBox that displays records based on each character as I type into the ComboBox.
The problem is, the underlying table for the ComboBox has about 500,000 records.
And the ComboBox object can only display 65,000 records before it reaches it's limit, and won't preview the rest of the records. Nobody looks at 65,000 records at the same time but when any number in the middle of the entire record set is typed, the records won't display at all. Because that particular number is beyond the 65,000 limit. So i need a dynamic combobox for the whole table.
For example, if you are looking at a bunch of SSNs, instead of ComboBox displaying all the records which it can't because too many SSNs (more than 65,000 which is ComboBox limit) this is what I need.
If you type 5 in the ComboBox. The list would only display the 5-series of numbers. If you type 51 it limits the list values are the 51-series of numbers.
If you type 512 it limits the list values to the 512-series of numbers and so on. FOR THE WHOLE TABLE THOUGH, not just the first 65K.
WHAT I HAVE TRIED SO FAR is implementing a second unbound text box, however, this makes querying a two step process. I am wondering if I can just do it all together.
David W Fenton already provided a fairly detailed answer to this problem here. The gist:
The simplest approach is to assign the combo box's Rowsource only after you type some characters in it. You'd do that in the combo box's OnChange event
Allen Browne's Combos with Tens of Thousands of Records has some other bells and whistles (abstracting the logic into a function, preventing recalculation of the RowSource if the value hasn't changed), but the basic idea is the same:
Leave the combo's RowSource property blank.
Create a function that assigns the RowSource after a minimum number of characters has been typed. Only entries matching these initial characters are loaded, so the combo's RowSource never contains more than a few hundred records.
Call this function in the combo's Change event, and the form's Current event.
If you really want to successively filter the RowSource as each character is typed, you could adapt these answers to do that. For example, you could change the test condition in the David W Fenton solution to If Len(Me!cmbMyCombo.Text) >= 1. For the Allen Browne solution, you could set the constant to 1 and change the line that sets sNewStub to: sNewStub = Nz(sSuburb, "").
However, until your RowSource query is returning a chunk of numbers that is less than the row limit, you're not going to see any benefit. This is why both solutions linked above begin filtering after 2 (or 3 or 4) initial characters have been typed.

Converting a percentage whole number in one field to a decimal in another field in Adobe Livecycle

I'm creating a budget template in Livecycle Designer.
I have a field where users can enter a percentage as a number (for example if you want to enter 75%, just enter 75).
I'd like another numfield box to take this number and convert it to .75
Can I do this across num fields or do I have to do it one box (where a user enters 75 and it turns into .75 automatically).
If you just want to enter integer numbers in the numeric field then that can easily be done by just taking a numeric field and then simply entering this javascript in the "exit event" of the field as:
var value1=this.rawValue;
this.rawValue="."+value1;

Paging with a data set that can be changing?

I'm sure there is something out there about this topic but I just can't figure out how to word a search for it.
I have a table of records that gets loaded into a paging grid in the UI. The user has the ability to update/modify these records..also multiple users can use the system at once all hitting the same data. I have a filter on the paging grid allowing the user to see only X type of records.
When the user first enters with filter X selected they see items 1-25 on page 1 of 2. They page to the second page where the items should be 26-50..but before they paged lets say 25 records on the first page had their type changed by another user, now they don't appear when selecting that filter. So now we have 25 less items to page through which means items that were 26-50 before are now items 1-25 and what was page 2 is now page 1 and there is no page 2...
You can probably see the issue I'm getting into, I'm passing an offset to the query to get the next page of results..but now that offset is so high it returns a blank page of records confusing the user and our record processing.
There isn't really an easy solution to this problem. Even GMail/Google doesn't show the exact number of messages/pages found when searching something.
The first thing you can do (if you use a DataGrid/CellTable) is set the boolean exact as false when you call updateRowCount, and give it your current number of records instead of your total number of records. This will make the pager display "1 - 25 of over 25" instead of "1 - 25 of 50".
The next possibility is to update the row count regularly (using RPC polling to check for new/deleted records - or using server push techniques, see GWTEventService and ServerPushFAQ).
You can also check if your request returns items or not, and cancel the call/update the row count if it doesn't.

Resources