User Overwriting data in a form

Tumby

Registered User.
Local time
Today, 05:59
Joined
Jan 12, 2009
Messages
64
:(I have today installed a database on to a network- successfully.

However, the first user immediatley over wrote the first field in the input form!

I have searched this forum for a solution to this problem and came accross the following code which will allow input in a new record but not allow overwriting or deletion of an existing record.

Code:
Private Sub Form_Current()
If IsNull(Me.[COLOR=red]Yourfield[/COLOR]) = True Then
Me.[COLOR=red]Yourfield[/COLOR].Enabled = True
Else
Me.[COLOR=red]Yourfield[/COLOR].Enabled = False
End If

I substituted the 'Yourfield' for my field name- Customer - put the code
in Form - Current window but it didn't work.

On looking at it do I have to state the variable?
Like-Dim Me As String
Me = "Customer"

Or something like that, as that didn't work either.
As you can see I am not into VB.

Can anyone please help?
 
However, the first user immediatley over wrote the first field in the input form![/QUOTE

If you change the form \data\data entry to "yes" , then when a user opens the form they will only see a blank form ready for data entry, and will not be able to view completed records.
 
Thanks John but that is no good.

The form has tabs and they each relate to the actual Customer who is on the first Tab.

If I do as you say, the form only opens with a blank record and users are not able to see the other Customers (200 of them!)
 
Assuming that when you substituted your actual field you spelled it correctly, The code should work as you intended.

No, you don't have to Dim Me. It is simply a shortcut for the current form name. Me.Customer tells Access that you're referring to the control named Customer on the form the code is attached to.

I'd double check the textbox name for your customer field and try it again.

What's more troubling is that your end user doesn't have enough sense to create a new record instead of entering data in an existing record. Are you going to have to do this for every control on your form? What happens if data changes or a mistake is made? How are you going to edit the data then?
 
Look at the Orders form in the Northwind sample db supplied with Access. There they have a combo box to select the client in the form header. The rest of the form has Data entry set to Yes so you can't overwrite the data
 
Thank you very much Missinglinq- don't know what I had done, but have just tried it again and it works fine.
NO I'm not going to do it to all the fields- I think the problem is that it's the first record on the form and the BOSS (yes the Boss) just gaily went tapping in another customers name thinking it would switch to the one he wanted. Not only that but he came out of the form so it saved the blank field that he had created!!!!

I've given him a search facility where he can searched using different criteria.

He thought he knew it all and was above waiting until tomorrow when I'm doing a training day.
Sorry to have wasted your time.

Thanks again!
 
Thanks Rabbi but I have 200 customers, think thats a few too many for a combo box!
 
Thanks Rabbi but I have 200 customers, think thats a few too many for a combo box!

No, that isn't too many for a combo box. In fact that is a good number. 66,000 is too many for a combo box.
 
And if you have the combo box's AUTO EXPAND property set to yes, when they start to type the name it will find it for you in the combo's list.
 
Thanks for that Boblarson- I'll note your suggestions for future use.

I'm thinking- everytime they have a new Customer it would have to be added to the combo box and I don't want to give them access to anything like that.
I don't want to appear condesending but I wouldn't trust any of the staff to meddle with queries or making reports or even looking at the tables etc...
I've set the front end to just open at a menu interface so they have access to all they need and are able to input everything for a new customer.
Thanks again for your help- not the first time either!
Thank You.
 
I'm thinking- everytime they have a new Customer it would have to be added to the combo box and I don't want to give them access to anything like that.
If you do a search here for "Not In List" you can find how you can open a form to add a new customer if they type something that isn't in the list.
 

Users who are viewing this thread

Back
Top Bottom