Lots of solutions, but try this:
In your code, before the queries are run:
DoCmd.OpenForm "MyForm", WindowMode:=acDialog
That pauses the code until the user dismisses the dialog.
Now in the Ok button of the form:
Me.Visible = False
This hides the dialog from the user, but leaves it open for your code to
read.
At the end of your code:
DoCmd.Close acForm, "MyForm
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mark" <mark.reed75@ntlworld.com> wrote in message
news:fIngd.31$zG6.27@newsfe4-gui.ntli.net...[color=blue]
> Thankyou both for your quick response.
>
> I understand what you are saying about using the unbound form to retrieve
> the value but what I dont get how to do is open the form mid way through
> my code when I need it, pause the code until the information has been
> input on the form and then resume the code where I can then reference
> their input???
>
> Thanks again,
>
> Mark
>
> "Mark" <mark.reed75@ntlworld.com> wrote in message
> news:x7ngd.148$NM.30@newsfe6-gui.ntli.net...[color=green]
>> Hi All,
>>
>> Access 2002 using Windows XP
>>
>> I am pretty new to writing code so please bear with me. I have some code
>> which exectues an append and a select query. Both queries require the
>> user to enter a date. Becaue of this, the same information has to be
>> entered twice which I would like to avoid.
>>
>> Is there a way using code, that I can prompt the user to enter the date
>> and save their input as a variable? I'm assuming that by doing it this
>> way, I can run the SQL's from within the code and use the stored variable
>> as the SQL criteria rather than calling the stored queries?
>>
>> Or maybe there's a completly better/easier way?
>>
>> Any help on this would be much appreciated.
>>
>> Regards,
>>
>> Mark[/color][/color]