View Full Version : Simple form problem


simongallop
11-08-2000, 02:22 AM
I am going round in circles. I have a form which allows me to edit records in a table. I want to be able to type in the index number and then the record will show in other text boxes for me to amend. Either I get the data into the boxes but they do not update the table or I get #Name? What is the simple step that I am missing?

Frustrated

Simon

Jimmy Turnip
11-08-2000, 03:37 AM
If I were doing this, I would create an unbound text box, which is used to type in the index of the record you want to update. Call this [txtInputIndex], say.

Now, in the OnUpdate event procedure of this text box, add the following code:

With Me
.Filter = "[MyIndex] = " & Chr(34) & .txtInputIndex & Chr(34)
.FilterOn = True
End With

NOTE: This assumes that MyIndex is a string field. If it's a number, get rid of the Chr(34)'s (they just give you " characters).

You may want to add in some extra code to validate the index that the user inputs, just in case they input one that doesn't exist. Try looking up On Error, MsgBox, and related topics in Access Help.

Good luck!

simongallop
11-08-2000, 03:45 AM
Spot on. Thanks v. much