User Input Validation (1 Viewer)

NearImpossible

Registered User.
Local time
Today, 14:18
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: 123

theDBguy

I’m here to help
Staff member
Local time
Today, 12:18
Joined
Oct 29, 2018
Messages
21,474
Perhaps, just use a form instead of a parameter prompt to ask for input.
 

oleronesoftwares

Passionate Learner
Local time
Today, 12:18
Joined
Sep 22, 2014
Messages
1,159
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.
 

NearImpossible

Registered User.
Local time
Today, 14:18
Joined
Jul 12, 2019
Messages
225
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 !!
 

oleronesoftwares

Passionate Learner
Local time
Today, 12:18
Joined
Sep 22, 2014
Messages
1,159
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:18
Joined
Feb 19, 2002
Messages
43,280
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

Top Bottom