Dat/Time Field, Mandatory Field text/VBA CODING!!!

jberry7285

Registered User.
Local time
Today, 23:15
Joined
Aug 6, 2010
Messages
16
Hi all,

I am knew to this forum so any help greatly appreciated.

I have a few problems with a DB I have created, if you feel you can help on any of the problems please reply to my thread!

1, I have a date and time field in my DB, In form view the D&T displays perfectly, in table view how ever the D&T do not pull through into the table on each record? Any ideas?

2, I have made some fields mandatory - is there a way i can change the text that is displayed if the field is not filled in - somethign more user friendly is what i am after!

3, I need a piece of code to do the followinf caluclations - i have a decent enough VB knowledge but im stuggling to get these to work!

Calculations:

Number of Nets * Cases Checked = Total (This box is hidden)

No Of Major Defects / Total * 100 = %

IF % is higher than 4 then the “CommandButton” says “NO”

IF % is less than 4 then the “CommandButton” says “YES”

This is my top priorirty problme if anybody can help!!

many thanks in advance!!

Jon
 
Can you post a zipped up copy of your Database here, minus any sensitive data and then we can look into it for you. I am at work for the next 2½ hours and have nothing else to do....
 
Many thanks for your reply,
I have tried to zip it down taking pretty much everything out of it but it stil is too big for this sites limit of 2MB

If maybe you have the time, you could just write me the relevant code an an example DB?

Many thanks for you help

Regs

Jon
 
Did you do a compact and repair?

To resolve issue 1 I will need to look at your table structure - I have a feeling that your Date & Time controls in your form are unbound.

For your mandatory fields, I will need to write some code in your forms BeforeUpdate event and also in your Save buttons OnClick event to perform the validation.

I will also need to get a better understanding of requirement 3 as it appears to me that you only wish to change the text on a command button, not what the command button actually does?


Try a compact and repair, then if you're still too big, strip out all data and pop 1 or 2 dummy records in for me. I leave in less than an hour.
 
Of course we can, just let me know when you're ready
 
Many Thanks Damo,

Late afternoon on a Friday not the time to start this.....im done with VB for today!!

Ill reply to this thread on monday to continue this

many thanks for you help

much appreciated!

Jon
 
I know how you feel - I am looking forward to a couple of days off myself
 
Morning Damo,

I have attached the form - i have took everything out of it apart from the relevant section i need the calcualtions on. Hence various errors now come up!! But still you get the idea!

The calulations i need coding in are as follows:

Calculations:

Number of Nets * Cases Checked = Total (This box is hidden)


No Of Major Defects / Total * 100 = %

IF % is higher than 4 then the “CommandButton” says “NO”

IF % is less than 4 then the “CommandButton” says “YES”

Also if anything is entered into the "unaccepatable" section the "Command Button" says "NO" -

The command button was pressed also needs to "save the record"



I look forward to your response.!

Kind Regards

Jon
 

Attachments

Jon

The attached database contains only your table and form. The form only has the code to display the result of the calculation required to change the caption depending on the percentage. I found that you were using two words for the name of fields try and use one word or two words with an underscore between them otherwise you will have problems running code etc.
 

Attachments

Thanks Poppa Smurf - have you also done the work for his first 2 questions? If not, I am on lunch now and will finish the job...
 
Many thanks for your help Psmurf....But...

The code you have written does not work

It calculates number of nets x cases checked but brings nothing through into the percetage field or the command button.

Any ideas....

Regards

Jon
 
No I have not done the first two as Jon said the third one was important.

Jon
In my version that I uploaded if I entered 25 for nets, 4 for checked and 4 for major defects 4% is displayed in the percent field and the caption is YES. When I change the major defects to 5, 5% is displayed and the caption is NO.
 
Hi Psmurf

What you have wrote is the coding i need but when i extract the db from the zip file it doesnt work?

the number of nets x cases checked calc works but none of the %?

Are you sure you've uploaded the saved version?

Regs

Jon
 
Sorry!!

I see how you have done it now!

Thats great!

Now for an extra bit....

If Major % is over 4% = NO (this works great)
If Minor % is over 10% = NO

If Major + Minor combined are over 10% = NO

If Unacceptable has any value = NO

Many thanks for your help much appreciated!!

regs

Jon
 
Jon

The 10% was not in your priority calculation see message 1.

I will redo your form etc and send a later version later today our time.
 
Jon

Here is an updated version. It only has one form all fields in the form are unbound, this was to save confusion with your field names etc. You have fields doing the same function e.g. Major Defects and N/o Major Defects. Also, the fields used to store defects etc. are shown as text in the table they should be integer for defects and maybe single or double for percentages.

In the form you will see code for a sub called calculate_percentages this calculates the percentages and changes the button caption as per your requirements.

If you have questions regarding the code please let me know.

Allan
 

Attachments

Hi Poppa Smurf,

I Cannot open the Db, I get this error (see attached)

I have saved it locally and tried to open it but i get the same error.

Regards

Jon
 

Attachments

I have attached it as zip file, I also added a doc showing the layout and the code used.

There is only one form in the database and it is not bound to a table.
 

Attachments

Users who are viewing this thread

Back
Top Bottom