By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

Tell me where i went wrong

100+
P: 103
want to check all the textboxes are filled and then only we can insert into the database.
i have used the textboxes is clear code
likewise

if text1.text = "" then
msgbox"enter data"
With txtid
.SelStart = 0
.SelLength = Len(txtid.Text)
.SetFocus
End With
Exit Sub
elseif text2.text = "".......like wise
'
'
'
else
conn.execute "insert into..........

but elseif is not executing
tell me where im wrong
Thanks in advance...
Dec 21 '07 #1
Share this Question
Share on Google+
7 Replies


debasisdas
Expert 5K+
P: 8,127
You need to use nested if for the purpose since using EXIT SUB.
Dec 21 '07 #2

100+
P: 103
You need to use nested if for the purpose since using EXIT SUB.
Im not able to get u ..little bit elaborated
Dec 21 '07 #3

100+
P: 274
Try something like this:

if text1.text = "" then msgbox"enter data"
With txtid
.SelStart = 0
.SelLength = Len(txtid.Text)
.SetFocus
End With
Exit Sub
IF text2.text = "".......like wise '
'
'
else

Endif ' End of inner IF statement
Endif ' End of Outer If statement

conn.execute "insert into..........
Dec 21 '07 #4

debasisdas
Expert 5K+
P: 8,127
Im not able to get u ..little bit elaborated
Hope the previous post clears your doubt.
Dec 21 '07 #5

100+
P: 103
Try something like this:

if text1.text = "" then msgbox"enter data"
With txtid
.SelStart = 0
.SelLength = Len(txtid.Text)
.SetFocus
End With
Exit Sub
IF text2.text = "".......like wise '
'
'
else
Endif ' End of inner IF statement
Endif ' End of Outer If statement
conn.execute "insert into..........

that too wasnt making out..............!!!
Dec 21 '07 #6

debasisdas
Expert 5K+
P: 8,127
that too wasnt making out..............!!!
try this
Expand|Select|Wrap|Line Numbers
  1. if text1.text = "" then msgbox"enter data"
  2. With txtid
  3. .SelStart = 0
  4. .SelLength = Len(txtid.Text)
  5. .SetFocus
  6. End With
  7. Exit Sub
  8. else
  9. IF text2.text = "".......like wise '
  10. '
  11. '
  12. else
  13.  
  14. Endif ' End of inner IF statement
  15. Endif ' End of Outer If statement
  16.  
Dec 21 '07 #7

Ali Rizwan
100+
P: 927
want to check all the textboxes are filled and then only we can insert into the database.
I m afraid of this y u all not maintain readability of ur programe.
Use tabs for clean coding.

When u use tabs like

Expand|Select|Wrap|Line Numbers
  1. if text1="" then
  2. msgbox "None"
  3. else
  4.       if text2="" then
  5.       msgbox "None"
  6.       end if
  7. end if
now u know where s the end of first if and where is for second and debugging is easy.

When u r posting any question try to put code quotes around code

Regards

>> ALI <<
Dec 21 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.