User Input Validation

NearImpossible

Registered User.
Local time
Today, 10:58
Joined
Jul 12, 2019
Messages
225
Is it possible to validate only numbers are entered when using a User Propmt Query?

I've tried the attached and it still allows letters or nothing at all and because my SQL Table DataType is 'Int" it just leaves the filed blank without erroring.
 

Attachments

  • Query.PNG
    Query.PNG
    5.2 KB · Views: 171
Perhaps, just use a form instead of a parameter prompt to ask for input.
 
query data type parameter.PNG


To specify the data type for parameters in a query:

  1. With the query open in Design view, on the Design tab, in the Show/Hide group, click Parameters.
  2. In the Query Parameters box, in the Parameter column, enter the prompt for each parameter you want to specify a data type for. Make sure that each parameter matches the prompt that you used in the Criteria row of the query design grid.
  3. In the Data Type column, select the data type for each parameter.
 
View attachment 97928

To specify the data type for parameters in a query:

  1. With the query open in Design view, on the Design tab, in the Show/Hide group, click Parameters.
  2. In the Query Parameters box, in the Parameter column, enter the prompt for each parameter you want to specify a data type for. Make sure that each parameter matches the prompt that you used in the Criteria row of the query design grid.
  3. In the Data Type column, select the data type for each parameter.
Thanks a million !!!

This works to validate its a numeric value, however it does still allow a blank entry, i'll work with this for now, may add a validation loop.

thanks again !!
 
Thanks a million !!!

This works to validate its a numeric value, however it does still allow a blank entry, i'll work with this for now, may add a validation loop.

thanks again !!
Glad you came to the forum for assistance, we are all here to help each other
 
If only data type matters, then using a prompt in a query is fine but if you need actual validation, it is far better to use a control on a form and reference that control form the query. We don't open queries for users to interact with so I'm assuming the query is either the RecordSource of a form or report or is being exported to Excel or a text file.
 

Users who are viewing this thread

Back
Top Bottom