dialog box to fill in text box in report

sasoderl

Board Regular
Joined
Feb 17, 2004
Messages
82
I would like to create one or more dialog boxes to use to fill in several text boxes in a report. I cannot find any information of how to do this using MS Help function nor in any book I have. Does anyone know if this is possible and if so, how can I attempt it?
 
Now, I am a bit confused. Earlier you recomended that I use the code builder on the OnOpen event to get the original input box to fill in the date field. So, now I cannot figure out how to change the properties of "text1" to not be called upon during the OnOpen procedure. Does this make sense?

Basically, in the properties for the report, under the events tab, in the OnOpen field, I clicked the button with the elipses and chose code builder. Then, wrote my code:

Function DateInputBoxText() As String
DateInputBoxText = InputBox("Enter the date", "Date")
MsgBox DateInputBoxText, vbOKOnly, "Value from InputBox"
End Function

Function ProductInputBoxText() As String
ProductInputBoxText = InputBox("Enter the product", "Product")
MsgBox ProductInputBoxText, vbOKOnly, "Value from InputBox"
End Function

Function RegNoInputBoxText() As String
RegNoInputBoxText = InputBox("Enter the Reg #", "Reg #")
MsgBox RegNoInputBoxText, vbOKOnly, "Value from InputBox"
End Function

Then, to each of these text boxes in the report, I assigned to them the relevant input box as you suggested:

="Date:" & " " & DateInputBoxText()

etc.

However, as I mentioned before, I have another text box that requires the same date. I have named them "DateField" and "DateField2". DateField is assigned the above statement and DateField2 is assigned:

[DateField]

That is exactly what I have done. I do not think I have left anything out. And I don't know how to fix the situation of having to enter the date twice. It wouldn't be that big of a deal, except that it is easy to make a mistake and it is important that the dates match each other. By the way, I am a newbie to Access.

Thanks again for all of your help
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Ok, I am concerned about this. Some reports can be 15 pages or more and it appears that for each page, the inputbox requests information. Is there a way to make it so it only requests the information once and fills in for all pages?
 
Upvote 0
Hullo. We have a "workaround" here that gets the job done: In the query that the report is based off, have some blank fields, and have a Criteria question reflecting what you are looking for the user to type. Then, in the report, reference these fields, and you should be fine.

HTH (y)

P
 
Upvote 0

Forum statistics

Threads
1,221,687
Messages
6,161,289
Members
451,695
Latest member
Doug Mize 1024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top