Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Find a Number and Date ...

I have create this user form that employees use to enter appointments
we have made. Currently the form has fields to enter values, with drop
down list etc... The next and final part to this project (thank god)
is a second form the user will use to search for an appointment they
made and then enter the remaining fields with the results and notes.

The form goes like this...

[Enter Client #:] [Text Box] [Search Button]
[Enter Appointment Date:]

[Showed List Box]
[Closed List Box]

Etc...

Here is the code I started with...

Private Sub Search_Click() 'Search Button
On Error GoTo errorHandler
Dim ClientNum As String
Dim AppDate As String
Dim startRow As Integer
Dim stopRow As Integer
ClientNum = ClientNum.text 'Enter Client # Text Box
If ClientNum = "" Then End
AppDate = AppDate.text 'Enter Appointment Date Text Box
If AppDate = "" Then End
ClientNum = Format(startDate, "#")
AppDate = Format(stopDate, "mm/dd/yy")
startRow = Worksheets("Appointment
Log").Columns("A").Find(ClientNum, _
LookIn:=xlValues, lookat:=xlWhole).Row
stopRow = Worksheets("Appointment Log").Columns("Z").Find(AppDate,
_
LookIn:=xlValues, lookat:=xlWhole).Row
Worksheets("Appointment Log").Range("C" & startRow & ":B" &
stopRow).Copy _
Destination:=Worksheets("Report").Range("A1")
End
errorHandler:
MsgBox "There has been an error: " & Error() & Chr(13) _
& "Ending Sub.......Please try again", 48
End Sub

What I would like to change and do is to have a hidden label show up
if the search results found the values or reverse if nothing was
found, instead of the MsgBox. If the values entered were found,
highlight the row in the work sheet and allow the user to fill in the
fields below the search fields. I plan on removing the Report
worksheet at the bottom of the code posted above.

Here is a picture of the second form that has been created.
http://picasaweb.google.com/mrmunka/Excel

I've beat my head like crazy trying to get this all to work and I'm
finally at the end and would like some assistance from thoughs of you
out there with much more experience than myself. I greatly appreciate
any help provided. Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find a Number and Date ...

I think your masjor problem is that text boxes returns text not numbers and
date. You need to convert the text

ClientNum = ClientNum.text 'Enter Client # Text Box
If ClientNum = "" Then End
AppDate = AppDate.text 'Enter Appointment Date Text Box
If AppDate = "" Then End

format converts numbers to text, you want text to number. Why is ClientNum
being set to a date????
from
ClientNum = Format(startDate, "#")
to
ClientNum = val(ClientNum)

from:
AppDate = Format(stopDate, "mm/dd/yy")
to:
AppDate = datevalue(stopDate)

" wrote:

I have create this user form that employees use to enter appointments
we have made. Currently the form has fields to enter values, with drop
down list etc... The next and final part to this project (thank god)
is a second form the user will use to search for an appointment they
made and then enter the remaining fields with the results and notes.

The form goes like this...

[Enter Client #:] [Text Box] [Search Button]
[Enter Appointment Date:]

[Showed List Box]
[Closed List Box]

Etc...

Here is the code I started with...

Private Sub Search_Click() 'Search Button
On Error GoTo errorHandler
Dim ClientNum As String
Dim AppDate As String
Dim startRow As Integer
Dim stopRow As Integer
ClientNum = ClientNum.text 'Enter Client # Text Box
If ClientNum = "" Then End
AppDate = AppDate.text 'Enter Appointment Date Text Box
If AppDate = "" Then End
ClientNum = Format(startDate, "#")
AppDate = Format(stopDate, "mm/dd/yy")
startRow = Worksheets("Appointment
Log").Columns("A").Find(ClientNum, _
LookIn:=xlValues, lookat:=xlWhole).Row
stopRow = Worksheets("Appointment Log").Columns("Z").Find(AppDate,
_
LookIn:=xlValues, lookat:=xlWhole).Row
Worksheets("Appointment Log").Range("C" & startRow & ":B" &
stopRow).Copy _
Destination:=Worksheets("Report").Range("A1")
End
errorHandler:
MsgBox "There has been an error: " & Error() & Chr(13) _
& "Ending Sub.......Please try again", 48
End Sub

What I would like to change and do is to have a hidden label show up
if the search results found the values or reverse if nothing was
found, instead of the MsgBox. If the values entered were found,
highlight the row in the work sheet and allow the user to fill in the
fields below the search fields. I plan on removing the Report
worksheet at the bottom of the code posted above.

Here is a picture of the second form that has been created.
http://picasaweb.google.com/mrmunka/Excel

I've beat my head like crazy trying to get this all to work and I'm
finally at the end and would like some assistance from thoughs of you
out there with much more experience than myself. I greatly appreciate
any help provided. Thanks in advance.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Julian date - find next highest date/number jchick0909 Excel Worksheet Functions 1 March 20th 08 11:38 PM
How to find the number of matched date? Eric Excel Discussion (Misc queries) 1 October 9th 07 11:37 AM
Find number of unique entries within a date range Gayla Excel Worksheet Functions 1 April 25th 07 11:42 PM
Find the row number with a date in it [email protected] Excel Worksheet Functions 3 January 11th 07 07:01 PM
How do I find total number workdays from a range of date faisalm Excel Worksheet Functions 3 July 4th 06 11:30 PM


All times are GMT +1. The time now is 02:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"