Form coding help Please

Gazza2

Registered User.
Local time
Today, 15:37
Joined
Nov 25, 2004
Messages
184
I am having a few form coding problems and i hope someone can help.
I have attached a copy of the form and the relating table so you can see what i have tried so far.

Basically i have the form which is used to add new customers to a table.
The first text box (accountcode) works how its supposed to in that i enter an accountcode and it goes to the next box if the code doesnt already exist,but it will not let you goto the next box until a code is entered.

The postcode textbox however is giving me a serious headache. If the user presses the enter key whilst in the text box but has not entered anything then a message box should display saying that a postcode must be entered, this doesnt work atall and just adds the record to the table and goes to a new record.

And finally the very last text box is used to enter the record into the table, delete the record entry or return to the beggining of the record to change some details. The problem im having with this is that the record is also added to the table if any other character is entered into the text box or if it is just entered through. I just need a text box to pop up sying that either Y or N only to be entered and return to the text box without adding the record.

Thanks in advance and sorry for the long and awkward post.
 

Attachments

Just a suggestion.

- If I were you, I would probably set those fields as unbounded objects.

- Show all the fields on the form to the user at the beginning.

- Put a little start (*) next to a field to indicate it is required.

- Provide a SAVE button so user can save the data or something.

If the SAVE button is click, just run a VBA code through all of the fields on the form and let user know if anything is missing. If not, save the data.

Don't need to hide all of the fields. It is stressfull for the user.

EZ
 
Thanks for the suggestions ezfriend.

I have made all fields visible and have put a star next to the required fields but i would rather a text box at the bottom as there will be other options available at a later date so i just need to know how to code the text box.

I have tried a select case statement but that doesnt seem to work either so i am obviously using the wrong wording somewhere in the code.

Thanks
 
Just a suggestion.

- If I were you, I would probably set those fields as unbounded objects.

- Show all the fields on the form to the user at the beginning.

- Put a little start (*) next to a field to indicate it is required.

- Provide a SAVE button so user can save the data or something.

If the SAVE button is click, just run a VBA code through all of the fields on the form and let user know if anything is missing. If not, save the data.

Don't need to hide all of the fields. It is stressfull for the user.

EZ
My sentiments exactly. I am not a big fan of databinding.
 
AnyWho, I think I have it in my notes that you can use the BeforeUpdate event to do validation and, if it fails, cancel the update, by setting Cancel = true.
 
I agree with you but the users want to use the keyboard for all their work so i have to make it the way i have to keep things easy for them.
 
note there is a FORM before update event you can use for general validation stuff

check the postcode at the end

then you can use postcode.setfocus to put the user back there if the field is invalid

-----------
note that your validation check on the blank field is probably failing because its a null

in the field before update, you can probably say

if nz(postcode,vbnullstring)= vbnullstring then
msgbox("Need a postcode")
cancel=vbcancel
end if

to deal with that
 
Another thing of note, you are turning off warnings in your subs but are not turning them back on.
 

Users who are viewing this thread

Back
Top Bottom