Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 16th, 2007, 11:51 AM
Registered User
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programming Up and Down Buttons to show dates in c

I am trying to show appointmentdate in the FromDate text field and use up and down buttons to requery date according to the dates in ther query and refresh the form with current data. I am really having problems and really need to get this accomplished. All help is greatly appreciated. I did not see a place to add the database so here is the code I have so far.

Option Compare Database
Option Explicit
'Public IsPreferredGroomer As Boolean
Public FromDateChanged As Boolean
Public CurrRecord As Double
Public Sub CustomerID_RowSource()

    If IsNull(Me![AppointmentDate]) Then
        Me![CustomerID].RowSource = "SELECT *" & _
                                   "From qryApptHist" & _
                                     " where (((AppointmentDate) >= [Forms]![frmPaymentHistory]![FromDate]))" & _
                                    " ORDER BY AppointmentDate;"
    Else
        Me![CustomerID].RowSource = "Select *" & _
                                   "From qryApptHist" & _
                                     " where (((AppointmentDate) = [Forms]![frmPaymentHistory]![FromDate]))" & _
                                    " ORDER BY AppointmentDate;"
    End If

    Me![CustomerID].Requery
End Sub


Private Sub DateDownButton_Click()
 FromDate = DateAdd("d", -1, FromDate)
   FromDate_AfterUpdate


End Sub

Private Sub DateUpButton_Click()
FromDate = DateAdd("d", 1, FromDate)
    FromDate_AfterUpdate
End Sub

Private Sub Form_Activate()
CustomerID.Requery
        Me.Requery
        CustomerID_RowSource
        Detail.Visible = False
        If CurrRecord > 0 Then
            Me.Requery
            DoCmd.GoToRecord acDataForm, "frmPaymentHistory", acGoTo, CurrRecord
        Else
            Me.Requery
        End If
        Detail.Visible = True
End Sub

Private Sub Form_AfterUpdate()
    Detail.Visible = False
    If CurrRecord > 0 Then
        Me.Requery
        DoCmd.GoToRecord acDataForm, "frmPaymentHistory", acGoTo, CurrRecord
    Else
        Me.Requery
    End If
    Detail.Visible = True
      FromDate.SetFocus
End Sub


Private Sub FromDate_AfterUpdate()
    FromDate = Format(FromDate, "short date")
    Me.Requery
    Me.Refresh
    CustomerID_RowSource
   Me![FromDate].SetFocus
    'DoCmd.Hourglass False
End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
device DLL programming in client side programming hendyhanusin ASP.NET 1.0 and 1.1 Professional 2 February 19th, 2009 12:01 PM
device DLL programming in client side programming hendyhanusin ASP.NET 1.0 and 1.1 Basics 0 March 21st, 2007 08:05 AM
device DLL programming in client side programming hendyhanusin ASP.NET 2.0 Professional 1 March 21st, 2007 08:04 AM
icons don't show on toolbar buttons MAKO C# 0 June 16th, 2006 11:37 AM





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