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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command button

Status
Not open for further replies.

compcad

Programmer
Mar 22, 2002
52
0
0
US
i have got a problem with a command button.
when i am searching for a certain RAFFLEID the command button seems to
work ok except when it does not find the RAFFLEID it goes to the first
record or if the text1.text is " " and you press the command button it
goes to the first record.

Private Sub cmdOk_RaffleID_Click()

'Enter RaffleId into textbox and press OK.

Data1.DatabaseName = DataPath
Data1.Connect = ";PWD=TheSecretPassword"
number1 = "select RaffleId, Prize1, NumberofTicketsAvailable,
shortdescription, longdescription, raffleenddate, Ticketcost, " & _
"timeplace, CharityName from raffles Inner Join charity on
Raffles.CharityId = charity.CharityId Where RaffleID like '" & Text1 & "*'"
Data1.RecordSource = number1
Data1.Refresh
Data1.Recordset.FindFirst "RaffleId = '" & Text1.Text & "'"
If Text1.Text = "" Then
Frame3.Visible = True
Label4.Visible = True
Shape1.Visible = True
Label4.Caption = "no such record was found."
Form1.Height = 4110
End If
Frame3.Visible = False
Frame1.Visible = True
Form1.Height = 4920

If Data1.Recordset.NoMatch Then
Frame3.Visible = True
Label4.Visible = True
Shape1.Visible = True
Label4.Caption = "no such record was found."
Form1.Height = 4110
End If

End Sub
when Data1.Recordset.NoMatch does not find a match i want FRAME3 to be
visable or when text1 = "" i want FRAME3 to be visible but not when it is
press twice. what am i doing wrong.


i have noticed something when i had tried to debug the code and it came to
this segment of the code listed in my fist post

when i set text1="" it will go to the if and then skip over and go to end
if and pass up the code inside the IF LOOP
If Data1.Recordset.NoMatch Then
Frame3.Visible = True
Label4.Visible = True
Shape1.Visible = True
Label4.Caption = "no such record was found."
Form1.Height = 4110
End If



i had tried using

If(Text1.Text = "" Or Data1.Recordset.NoMatch)
.
.
.
End If

it still is skipping over the statements within the If Then Loop. i am wondering if it could be the datatype. a sample of the data that goes to text1 is as such:
CB02FALL or CB03SPRING
i need help

THANK YOU
STEPHEN MENTZER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top