Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input mask -- Parameter Input 1

Status
Not open for further replies.

Dewey

Programmer
Jan 25, 2000
21
US
Is there a way to set a Input Mask &quot;__/__/__&quot; in the Enter Parameter Box at the start of a Query&nbsp;&nbsp;&nbsp;Throughout the forms, you can, I have been looking and can find no answer, maybe someone knows for sure... thanks in advance for reading this <p>Dewey Davis<br><a href=mailto:ddavis@dfn.com>ddavis@dfn.com</a><br><a href= > </a><br>
 
Nope<br>You could do something like<br>[Please Enter Date in form 00/00/00]<br>in your prompt
 
Doug, that is what I am doing now. Why i would like the mask is that you do not have to input the <p>Dewey Davis<br><a href=mailto:ddavis@dfn.com>ddavis@dfn.com</a><br><a href= > </a><br>
 
You need to explain this better...<br><br>These guys are good and they can help you !<br><br>Please elaborate ...<br><br>I don't understand what you're trying to do .?.?.?<br><br>Mav...<br><br><br>
 
i have the same problem:<br><br>i use a query to open a report.<br><br>the [lazy] users don't want to write the slashes for the date parameters, they want them to appear in the dialog box. there does seem to be any way to create an input mask for a field in a parameter query.
 
Build a form with the date and format (and probably and OK button), and feed the text box value into the query.<br><br>
 
try to explain further.. my form is a datasheet, and when it first opens, you get the query date (where i would like to have the mask, without the slashes.&nbsp;&nbsp;Once the form is opened and displayed( approx 4000 records, we then sort or find on a particular field.&nbsp;&nbsp;Each time, it asks again&nbsp;&nbsp;for the query dates.&nbsp;&nbsp;We does this probably 40-60 times to this form and a mask would be very helpful as well as match the other places where the mask can be used... Maybe not possible, but someone might have a clue... thanks again<br>Dewey <p>Dewey Davis<br><a href=mailto:ddavis@dfn.com>ddavis@dfn.com</a><br><a href= > </a><br>
 
dewey,<br>Formatting the Access Input Box is just not possible.&nbsp;&nbsp;However the result you want is...<br>You need to have a form with a textbox that has a date format (call it txtDate), then a button that sets the sql based on that texttox, and opens the query. (you weren't clear as to whether this was a form in datasheet view based on the query or just the query).&nbsp;&nbsp;Anyway, you also would have some checkboxes that correspond to different fields to sort on (for simplicity, say you have a LastName in the query, we start with a checkbox called chkLastName).&nbsp;&nbsp;Lets say you have the query as a basic select, with no Where or Order by clauses to begin with (this is the quick and dirty way to set the sql):<br>dim sq as string,qd as querydef<br>set qd = currentdb.querydefs(&quot;myquery&quot;)<br>sq = qd.sql 'now sq is something like &quot;Select blah, blah, From myTable&quot;<br>sq = sq & &quot; Where [theDateField] = #&quot; & me!txtDate & &quot;#&quot;<br>If ChkLastName = true then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sq = sq &quot; Order by LastName&quot;<br>end If<br><br>docmd.runsql sq<br>'Or you could do:<br>qd.sql = sq<br>docmd.openquery qd.name<br><br>That should do it<br>--Jim
 
This site has some instructions on how to do what you want, using a form that opens the report:<br><br><A HREF=" TARGET="_new"> <p>Linda Adams<br><a href=mailto:Garridon@aol.com>Garridon@aol.com</a><br><a href= Adams Online</a><br>I'm a professional writer, published internationally.
 
It is best not to let users start a query with variables because users can make mistakes easely.
A query can be made by a form, I am Dutch and in Holland the date format is dd-mm-yyyy, this is not the format used in a sql statement so it is impossible to let users fill out a variable when opening a query.
This can be a solution:
put this in a module to use it over and over

Public Function tousdate(datein As Date) As String
Dim outgoing
outgoing = Month(datein) & &quot;/&quot; & Day(datein) & &quot;/&quot; & Year(datein)
tousdate = outgoing
End Function

The form where you start your query with contains a button wich will delete a query and make it based on the date (and other stuff) which is filled in the form.
The following code can be used to delete and make a querry called dubbel:

DoCmd.DeleteObject acQuery, &quot;dubbel&quot;

Set qdfcheck = CurrentDb.CreateQueryDef(&quot;dubbel&quot;, _
&quot;SELECT * FROM EBANKING where date > #&quot; & tousdate(me.datefield) & &quot;#;&quot;)
Set rstdubbel = qdfcheck.OpenRecordset


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top