Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2005, 07:08 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jnaylor28
Default Creating a report receiving input on range

Hi,

    Trying to figure out where I went wrong with this chunk of code What I'm basically trying to do is, have a user enter two dates into text boxes(with the appropriate inputmask) To define a range to display on a report. So I've been poking at this for the last few hours, the date is being extracted fine, and inserted into the variables fine according to the Watches I've placed on the variables. What I think it is is something in the syntax in the DoCmd.OpenReport, But I'm not sure, all I know is that it was inserting the date fine into the WHERE part of the DoCmd.OpenReport line. I left some rem statements in there, as I tried it a few different ways just for fear. Forewarning, this entire current project is my first attempt at Access/VBA programming, so it may not look pretty. Thanks in advance for any help.




Private Sub ViewPayrollByEmp_Click()
On Error GoTo Err_ViewPayrollByEmp_Click

    Dim dtDateFrom As Date
    Dim dtDateTo As Date
    Dim stWhere As String
    Dim stDocName As String
    If IsNull(Me.PayrollEmpDateFrom.Value) And IsNull(Me.PayrollEmpDateTo.Value) Then
    Exit Sub
    Else
    dtDateFrom = Me.PayrollEmpDateFrom.Value
    dtDateTo = Me.PayrollEmpDateTo.Value

    stWhere = Chr$(34) & "[InspectionDate] between " & dtDateFrom & " AND " & dtDateFrom & Chr$(34)
    stDocName = "Payroll"
        'stWhere = Chr$(34) & "InspectionDate >= " & dtDateFrom & " AND " & "InspectionDate <= " & dtDateTo & Chr$(34)
        DoCmd.OpenReport stDocName, acPreview, , stWhere
    End If

Exit_ViewPayrollByEmp_Click:
    Exit Sub

Err_ViewPayrollByEmp_Click:
    MsgBox Err.Description
    Resume Exit_ViewPayrollByEmp_Click

End Sub
 
Old July 12th, 2005, 11:54 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jnaylor28
Default

Oops , ok I need to dig more, found the exact same thing in an article farther in.

Sorry about that






Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a form with input text that is populated shawn.bordeaux Classic ASP Basics 0 November 10th, 2008 11:22 PM
Limit input range millieamp HTML Code Clinic 1 November 8th, 2007 09:40 AM
Input in Access Report mateenmohd Access 5 April 20th, 2004 04:51 AM
Creating an Input Mask in a text box in VB.NET ysu_computer_lab VS.NET 2002/2003 1 November 5th, 2003 02:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.