473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Parameter dialog box

Hi, I have created databases. But, I am green when it comes fixing damaged Access databases. I am trying to change a parameter dialogue box in a form. Then create a link to the reports (with the ability to print just that report) from the database. So far, this what I have....
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOK_Click()
  2. Const cInvalidDateError As String = "You have entered an invalid date."
  3. Dim strWhere As String
  4. Dim strError As String
  5.  
  6.     strWhere = "1=1"
  7.     strReports = "Reports.[lstReports]"
  8.  
  9.     'If StartDate
  10.     If IsDate(Me.txtStartDate) Then
  11.         'Add it to the predicate - exact
  12.         strWhere = strWhere & " AND " & "Issues.[Opened Date] >= " & GetDateFilter(Me.txtStartDate)
  13.     ElseIf Nz(Me.txtStartDate) <> "" Then
  14.         strError = cInvalidDateError
  15.     End If
  16.  
  17.     'If EndDate
  18.     If IsDate(Me.txtEndDate) Then
  19.         'Add it to the predicate - exact
  20.         strWhere = strWhere & " AND " & "Issues.[Opened Date] <= " & GetDateFilter(Me.txtEndDate)
  21.     ElseIf Nz(Me.txtEndDate) <> "" Then
  22.         strError = cInvalidDateError
  23.     End If
  24.  
  25.     If strError <> "" Then
  26.         MsgBox strError
  27.     Else
  28.         DoCmd.OpenReport strReport, acViewPreview, , strWhere
  29.     End If
  30.  
  31.     Me.frmWhatDates = strWhere
  32.     Me.frmWhatDates.FilterOn = True
  33.  
  34.     End If
  35.  
  36. End Sub
  37.  
  38. Function GetDateFilter(dtDate As Date) As String
  39.     ' Date filters must be in MM/DD/YYYY format
  40.     GetDateFilter = "#" & Format(dtDate, "MM/DD/YYYY hh:mm:ss AM/PM") & "#"
  41. End Function
  42.  
May 14 '07 #1
1 1350
MMcCarthy
14,534 Expert Mod 8TB
This question has been moved to the Access forum from Introductions forum.

ADMIN
May 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: AMS | last post by:
I am trying to create a thread to execute a script for me and then display the output in notepad. What is happening is when I call the CreateThread method and pass in the Routine and Parameter...
2
by: The Plankmeister | last post by:
Hi... I have a query which I'm accessing through PHP as a stored procedure. However, I need to be able not to pass a couple of parameters in certain situations. When I do this, I get an error: ...
4
by: Ron Rohrssen | last post by:
I want to show a dialog and when the form (dialog) is closed, return to the calling form. The calling form should then be able to pass the child form to another object with the form as a...
2
by: Roger | last post by:
Anyone know how to pass a parameter to a query via a report in Access 2003?
2
by: Miguel | last post by:
I have followed the advice noted throughout this group for capturing parameter values in a report header. It works, but the parameter dialog box appears twice,once for the query and once for the...
2
by: billtubbs | last post by:
Hi I am getting the common problem of the "Enter Parameter Value" dialog box, which pops up every time I execute a query. I built the query using the Expression Builder in Access. If any of my...
4
by: jaegertw2 | last post by:
Hey guys, I have a weird one. My database has about 25 users, and today one of the users came to me and informed me she was getting an error message, which turned out to be query parameter dialog...
1
by: waltnixon | last post by:
I've got an MS Access query which runs fine when double clicked and returns all of the rows in a test database I'm building. I've set up a multi group report based on the query. I immediately...
1
by: Sport Girl | last post by:
Hi everybody, please can anybody help with this question: I an working with Acees 2007, and everytime I run a report I have a dialog box prompting "Enter Parameter Value" requesting for a...
10
by: akirekab | last post by:
I am running a report in Access. When I click to run report, a dialog comes up for missing parameter, showing just the name of a table in the box. Now if I just click ok without typing anything...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.