?
Solved

Visual basic form

Posted on 2003-03-11
2
Medium Priority
?
202 Views
Last Modified: 2013-11-25
I have table Employee in database with 5 fields (id, FirstName, LastName, Age, BirthDate, Salary)
I want to wright form in visual basic that has 2 textboxes ( FromDate, ToDate ) and button -("Go").
When I press on button I want to see table Employee filtered by BirthDate.
Can somebody explain with code example how I do it. Working example will be graded with 100 points more.
Thank you in advance.
0
Comment
Question by:LazyStudent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
JRCSystems earned 375 total points
ID: 8111289
Private Sub cmdGo_Click()
Dim pdDateFrom as Date
Dim pdDateThru as Date
Dim psSQL      as String
Dim poRS       as RecordSet


    if IsDate(txtDateFrom.text) then
       pdDateFrom = CDate(txtDateFrom.text)
    else
       pdDateFrom = 0
    end if

    if IsDate(txtDateThru.text) then
       pdDateThru = CDate(txtDateThru.text)
    else
       pdDateThru = Now
    end if

    psSQL = "Select * from Employee where " _
            "BirthDate >= #" & pdDateFrom & "# AND " & _
            "BirthDate <= #" & pdDateThru & "#"

   
    set poRS = moDB.OpenRecordset(psSQL, dbOpenDynaset)
    Do While not poRS.EOF
'      print/display data
       poRS.MoveNext
    Loop
    poRS.Close
    set poRS = Nothing

End Sub

0
 
LVL 5

Author Comment

by:LazyStudent
ID: 8111528
Can you provide 'print/display data ? ( better - list(Report) control?
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question