Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tricky interface issue 1

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
I am currently populating a combo box on Form Load with 14 day interval between date. The users change the date using the

drop down arrow of the combo box.

Code:
Private Sub Form_Load()
Dim startDate As Date

startDate = CDate("5/20/2006")

cboPPStartDate.AddItem startDate

Do While startDate < CDate("1/1/2007")
    startDate = DateAdd("d", 14, startDate)
    cboPPStartDate.AddItem startDate
Loop
End Sub

I want to change the interface to allow user to change the Dates using two command buttons
named cmdNext and cmdPrevious.

I figured I would populate a text box value using

Code:
=cdate("5/20/2006")

But I ran into the issue that the cmdNext click event would not be able to change the date because that code was placed in

the Control Source. I then tried "select startdate from tblpayperiod" because I create a table called tblpayperiod and placed the startdate there but then when my for loaded I got #Name?

How can I create this interface? Is there a way to use the combo box but not have the drop down arrow appear? Any Ideas or thoughts? I am stalled on getting the startdate on the form




following code on the cmdNext click event
Code:
txtStartDate.Value = dateadd("d", 14, txtStartDate.Value)
[code]

and the following code on the cmdPrevious click event
[code]
txtStartDate.Value = dateadd("d", -14, txtStartDate.Value)
[code]


The issue I am having is the code to 


Newbie in search of knowledge
 
Are you trying to set up the up the combo box to always allow the user to see dates from either the previous, current, or next pay periods? If so, how are your pay periods structured? Since you have created a table, why not build a query referencing the values in the table?

Tom

Live once die twice; live twice die once.
 
Hiya, vttech,

Is [blue]=cdate("5/20/2006")[/blue] your control's Control Source? A better choice might be the Default Value. Then under your command buttons:
Code:
Me!txtStartDate = Me!txtStartDate + 14
And
Code:
Me!txtStartDate = Me!txtStartDate - 14
HTH,

Ken S.
 
The problem with referencing the values in the table is that the table only has two date start and end date
example:

StartDate EndDate
5/20/2006 6/2/2006

The start date and end date interval is 13 days
the interval between each start date is 14 days
the interval between each end date is 14 days

I thoughts of creating the table to hold all the start and end dates but thats too much work too do it manually. I guess the first step would be to figure out how to do create the table using an SQL statement. Any ideas?


Newbie in search of knowledge
 
Create the table in Excel (very easy) and then import it.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Take a look at the INSERT INTO, MAKE TABLE and DROP TABLE statements.

Tom

Live once die twice; live twice die once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top