Re: Check zero value before being allowed to close form
Bravo, Sean - the most of us learned, along with the help of the board.
Announcement
Collapse
The Alpha Software Forum Participation Guidelines
The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
- Be professional in your conduct
- Be kind to others
- Be constructive when giving feedback
- Be open to new ideas and suggestions
- Stay on topic
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
- Spam.
- Vulgar language.
- Quotes from private conversations without permission, including pricing and other sales related discussions.
- Personal attacks, insults, or subtle put-downs.
- Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
- Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
- Sexually explicit or violent material, links, or language.
- Pirated, hacked, or copyright-infringing material.
- Encouraging of others to engage in the above behaviors.
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
- Remove the Post or Thread - the content is removed from the forum.
- Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
- Temporarily Ban the User - user is banned from forum for a period of time.
- Permanently Ban the User - user is permanently banned from the forum.
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less
Check zero value before being allowed to close form
Collapse
X
-
Re: Check zero value before being allowed to close form
Originally posted by martinwcole View PostYour replys suggest you really need help in understanding how Alpha works.
These are not mission critical projects. I can wait until I learn how to do it. In the meantime I'll continue with what has been working. I appreciate the help in the forum but I tend to read and experiment myself until I learn it. I get a lot of good tips and some general direction here in the forum and that's all I was looking for, some tips. Now that I know about the form Events I will study up on that.
Thanks again.
Leave a comment:
-
Re: Check zero value before being allowed to close form
Sean, if I were you I would employ Tom to come on your computer with Logmein or similar. Your replys suggest you really need help in understanding how Alpha works.
Leave a comment:
-
Re: Check zero value before being allowed to close form
I have a "Save" button on the form. I entered the error checking script in the OnSave event and this works fine.
I also have a "Save and Close" button. I also entered the script on the OnExit event. I get the error message but the form still closes when the "Save and Close" button is used. That button is is programmed to first save the record and then close the form. I get the error message twice but the form closes anyway and the record is saved with the variance field with a wrong value (meaning there is an entry error somewhere).
I'm wondering if I should put something in the "Save and Close" button to prevent the actions if the error script is tripped. Not sure what that is. Any ideas on how to keep the form from being closed and the record saved?
Leave a comment:
-
Re: Check zero value before being allowed to close form
I was able to get the warning message to show. Thanks for your help. But I can't keep them from closing the form. The message pops up but the form closes anyway after they click on OK. This is probably because I don't know a lot about how to execute a script. What command has to be entered after msgbox() and cancel() in order to keep the form open?
Leave a comment:
-
Re: Check zero value before being allowed to close form
In this case the set consists of two tables, the Transaction table and the Customer table. The set is used only to link the customer name and number to the transaction entry. I'm sure there are times when I am using multiple records from a child table but in this case each time I enter a transaction with this form I'm entering a new record into the Transaction table. The customer record is not added as it must already exist before the Transaction can be entered. In our terminology the Transaction record represents a single sales slip.
Leave a comment:
-
Re: Check zero value before being allowed to close form
Maybe a picture of the form will help?Transaction Form.png
Leave a comment:
-
Re: Check zero value before being allowed to close form
Sean,
You may need to re-think the concept of a "record". In your first post it sounds like you use that term to refer to the entire transaction. In databases like Alpha Five the term has a very different meaning. In your set based form each "transaction" probably has a single "record" entered to the parent table in your set, and multiple "records" entered into the linked child table. The parent table record will be saved as soon as editing a new child record begins. If you are entering child table records through an embedded browse each row gets saved when the user navigates to a different row, or clicks on a field in the form outside the browse object. All of this can be managed but its not particularly easy, and is impossible for us to specify for you, given the limited amount of information you've furnished and the absence of a working sample.
Leave a comment:
-
Re: Check zero value before being allowed to close form
Thanks guys. Yes, this form is based on a set. And I probably should consider putting this kind of thing in the table field rules. I'll start messing around with that idea. In the meantime this solution looks like I might at least be able to show a warning message if they try to close the form before making sure the numbers are correct. I'm still a little unsure of how to get this script into the form but at least I now have a clue. I'll experiment and see if I can figure it out. It's about time I learned how to do some simple Xbasic scripts instead of just using the Active Script genies.
Thank again.
Sean
Leave a comment:
-
Re: Check zero value before being allowed to close form
Martin, I'm not sure. That works well for a data entry form based on a single table, but its beginning to sound like he's got a set based form, that probably includes multiple child table records. what's needed is an event that fires before the user can leave the current transaction. -- tom
Leave a comment:
-
Re: Check zero value before being allowed to close form
Sean, put Tom's code in the canexit event for the form. Action scripting is not needed. In design mode, at the top of the screen, where you see Form, right click and you will see many form events - one of them is CanExit
Tom, do you think this might be better handled in the cansaverecord event in field rules?
Leave a comment:
-
Re: Check zero value before being allowed to close form
[ deleted duplicate ]
Leave a comment:
-
Re: Check zero value before being allowed to close form
Sean,
Assuming the two calc display fields are numeric data, something close to this should do the trick
In the CanExit event for the form:
Code:if calc->cmtrlvariance <> 0 .or. calc->cvariance <> 0 then msgbox("Oops","Your transaction is not in balance, check your variance values and correct before closing the form.") cancel() end if
We can't see the entire data entry sequence. The solution above should solve the immediate problem but it would not prevent the user from entering incorrect data for two separate transactions back to back. why? because they wouldn't try to close the form after each transaction so the CanExit wouldn't fire until they try to close the form after the 2nd transaction. Is this clear?
You probably need to think more carefully about when you want this type of validation to occur, limiting it to attempts to close the form may not cover all the situations you may need.Last edited by Tom Cone Jr; September 03, 2013, 09:00 AM.
Leave a comment:
-
Re: Check zero value before being allowed to close form
Originally posted by martinwcole View Postput this in the form's canexit event
if somevalue <> 0
cancel()
end if
Sean
Leave a comment:
-
Re: Check zero value before being allowed to close form
Thanks Al,
I looked at that but I could not figure out how to "test that it is or is not zero"
Leave a comment:
Leave a comment: