Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

else if statment & print

Posted on 2002-05-11
5
Medium Priority
?
142 Views
Last Modified: 2010-05-02
Hi
How can I use the if ststment in VB I tried to use it but it gives me error

Aslo how I can print which command Im using ADODC connection and I want to print All the fields with thier labels

Please tell me ASAP



 If invoice.Text1.Text = "" Then
    invoice.Text1.Text = Text1.Text
    invoice.Text2.Text = Text7.Text
    invoice.Text5.Text = Text2.Text
    invoice.Text6.Text = Text12.Text
    Adodc1.Recordset.Update
    invoice.Text4.Text = Date
   
     num = Val(Text9.Text)
     num = num - Text12.Text
     Text9.Text = num
     Text9.SetFocus
     Adodc1.Recordset.Save
     Frame2.Visible = False
     Parts.Hide
Else if//////////////I does not work
    invoice.Text7.Text = Text1.Text
    invoice.Text12.Text = Text7.Text
    invoice.Text10.Text = Text2.Text
    invoice.Text11.Text = Text12.Text
   
   
   
Else if  invoice.Text7.Text = (0) Then///////doesnot work
    invoice.Text15.Text = Text1.Text
    invoice.Text18.Text = Text7.Text
    invoice.Text16.Text = Text2.Text
    invoice.Text17.Text = Text12.Text
    invoice.Show
     End If
0
Comment
Question by:furious581
[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
5 Comments
 
LVL 3

Expert Comment

by:Randy Bristow
ID: 7003693
you have no condition listed for this else if

Else if//////////////I does not work
   invoice.Text7.Text = Text1.Text
   invoice.Text12.Text = Text7.Text
   invoice.Text10.Text = Text2.Text
   invoice.Text11.Text = Text12.Text


try:


Else if PLACE CONDITION HERE Then
   invoice.Text7.Text = Text1.Text
   invoice.Text12.Text = Text7.Text
   invoice.Text10.Text = Text2.Text
   invoice.Text11.Text = Text12.Text


Randy
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 360 total points
ID: 7003787
Else if  invoice.Text7.Text = (0) Then///////doesnot work
   invoice.Text15.Text = Text1.Text
   invoice.Text18.Text = Text7.Text
   invoice.Text16.Text = Text2.Text
   invoice.Text17.Text = Text12.Text
   invoice.Show
    End If

change to
Else if  invoice.Text7.Text = "0" Then///////doesnot work
   invoice.Text15.Text = Text1.Text
   invoice.Text18.Text = Text7.Text
   invoice.Text16.Text = Text2.Text
   invoice.Text17.Text = Text12.Text
   invoice.Show
    End If

a comparison of .text field requires a string.


An option could be
If invoice.Text1.Text = "" Then
  YOUR CODE FOR THIS PART
Elseif  invoice.Text7.Text = "0"
  YOUR CODE FROM THIS PART
Else
  YOUR CODE FROM THE ELSEIF WITHOUT THE COMDITION
end if


mlmcc
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7003802
and use elseif instead of else if
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7003921
And use Select case if possible instead of a bunch of elseif.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 7004721
your code should look like this:

Elseif  invoice.Text7.Text = "0" Then
  invoice.Text15.Text = Text1.Text
  invoice.Text18.Text = Text7.Text
  invoice.Text16.Text = Text2.Text
  invoice.Text17.Text = Text12.Text
  invoice.Show
End If

It is also a VERY goopd idea to NAME your text boxes with MEANINGFUL names, rather that keep the DEAFULT names (Text1 does not mean anything where txtInterestRate or txtValue does).  Just a suggestion.

Arthur Wood

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

670 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