Hot Topic (More than 10 Replies) What am I doing wrong? (Read 9856 times)
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
What am I doing wrong?
Jan 18th, 2005 at 7:33pm
Print Post Print Post  
I have a subform shown in a table view format. The first field is a date field the next is a comments field I have it entering a date in the field when I exit the comments field using on exit program. My first problem is every time I enter the comments field it shrinks down the date field in the previous comments so it is not readable. It also does not update until I exit the entire record. What am I doing wrong? What do I do?

  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: What am I doing wrong?
Reply #1 - Jan 18th, 2005 at 8:02pm
Print Post Print Post  
Bill,

I do not know if your doing anything wrong, If I understand the problem you are describing I have the same problem when I first am laying out my forms with the subforms. My solution might not be correct (The Lanticans will need to correct this if its wrong) but my solution always fixes my problem. Smiley

First I believe if you just go to the database form that contains your Comment element  that displays in the subform and resize making the element a little smaller it will solve the shrinking of the date field.

(Bill I just took a look at the database you E-mailed me the other day with the Tab problems. If the database you are talking about is the same I just used this above fix on your comment subform and it worked.)

I changed the comment element size by
Opening sdesigner
Opening your DSR
Click forms
Click redesign customize a form
Click on contact
Click on comments
Click on comment
Click on the comment element
Hold the Shift key and press the back arrow key about 6 times to resize the element smaller
Click Save Layout Design
Preview your app to make sure the element is the correct size
Exit preview
Reconcile your app

The reason the date does not update until you exit the entire record is because you have your code in on element exit but you never exit that element because there are no other elements on the subform to go to.

I solved this by using the throwfocus() command to exit the comment element thus allowing your code to execute. I edited your code to below.

IF CommentDate = "" and Comment <> "" Then

{

     CommentDate = @date
     Throwfocus(CommentDate)
}


(you might also want to look at using @isBlank() instead of the double quotes. @isBlank is more reliable. Check out page 22 of the new supplement, It explains)

I hope this helps and I am sure a Lantican will jump in if my solutions are to far off.

Robert
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: What am I doing wrong?
Reply #2 - Jan 18th, 2005 at 10:00pm
Print Post Print Post  
Quote:
( I just took a look at the database you E-mailed me the other day with the Tab problems. If the database you are talking about is the same )

Yes this is the same database you helped me with last week.



I followed your steps on this recent problem and it  worked like a charm. Thank you Bob
  
Back to top
 
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: What am I doing wrong?
Reply #3 - Jan 19th, 2005 at 4:15pm
Print Post Print Post  
Quote:
(you might also want to look at using @isBlank() instead of the double quotes. @isBlank is more reliable. Check out page 22 of the new supplement, It explains)


Bob

I think I see how to use @IsBlank for empty but NOT how when I want to use not empty also for example

I want to say if field1 is empty and field2 not empty do x

IF @IsBlank(field1)  and  field2 <> "" Then

{

}
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: What am I doing wrong?
Reply #4 - Jan 19th, 2005 at 4:20pm
Print Post Print Post  
You would want to use the 'Not'  Operator found on page 41 of the programming manual.

If (@IsBlank(Field1)) and (Not @IsBlank(Field2)) Then
{

}
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: What am I doing wrong?
Reply #5 - Jan 19th, 2005 at 4:27pm
Print Post Print Post  
Try this


IF (@IsBlank(field1))  and (Not @IsBlank(field2))  Then
{

}

I am not sure if the parenthesis around the Not statement are needed but this is what I have been using.


This is the way Ray the Reaper did it in the great Sesame Seasons example he wrote and I have found Ray to be a great example to copy.

Modified - Rays response was quick. I must have been typing and thinking slow while he was typing and thinking very FAST.

I also just learned from Rays post I should add parenthesis around my (@IsBlank(field1))  statement also. Thanks RAY. Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: What am I doing wrong?
Reply #6 - Jan 19th, 2005 at 4:36pm
Print Post Print Post  
Thanks  for the speedy responses
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: What am I doing wrong?
Reply #7 - Jan 19th, 2005 at 4:44pm
Print Post Print Post  
Quote:
I also just learned from Rays post I should add parenthesis around my (@IsBlank(field1))  statement also. Thanks RAY. Smiley


Hi Robert,

The parenthesis around the first @IsBlank are not required, I just put them in there for some reason. It will work without them as well.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: What am I doing wrong?
Reply #8 - Jan 19th, 2005 at 9:25pm
Print Post Print Post  
Ray or ??  why does this work fine with if vAdd <> "" then       but not with        if (Not @IsBlank(vAdd))



var vAdd as string

vAdd = Co_street1 + co_city1 + Co_state1 + co_zip1

// Writeln(Vadd)

// if vAdd <> "" then

  if (Not @IsBlank(vAdd))  then
{
if @AskUser("There is existing data in the ship to fields", "do you want to replace","existing ship to data with Mailing address") 
{
  Co_street1 = co_Ship_street
  co_city1 = co_Ship_city
  Co_state1 = co_Ship_state
  co_zip1 = co_Ship_zip
}
}
else
{
Co_street1 = co_Ship_street
  co_city1 = co_Ship_city
  Co_state1 = co_Ship_state
  co_zip1 = co_Ship_zip

}



Thanks for any help you can offer.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: What am I doing wrong?
Reply #9 - Jan 19th, 2005 at 9:54pm
Print Post Print Post  
Hello Robert,

@IsBlank is for elements only. vAdd is a String variable so you check it with <> "" or use @Len()

ex.
If @Len(vAdd) > 0 Then
{

}

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: What am I doing wrong?
Reply #10 - Jan 19th, 2005 at 10:13pm
Print Post Print Post  
See why more Sbasic classes are so important, I was thinking I could use variables the same way I used elements only the variable were temporary holding places.

Thank you so much for the clarification.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged