Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting or updating record

Status
Not open for further replies.

gavjb

Technical User
Jul 5, 2005
67
GB
Hi,

On my master form in my project, when a user enters a reference number (StudentRef), I need to be able to check if the record exists in UCI table (PK of StudentRef), and if it exists read the data from UCI field, but if no record exists then to create a record.

I have tried playing around with recordcount propery, but have got inconsitant results, does anyone know of an easy way to do this.


Thanks,


Gavin,
 
Worked it ot, if I open the ecordset as static, then the count works
 
easy way? you mean one which doesn't involve any code or something quick and simple to implement?

if you don't want code, then you could set up a form/subform solution with the subform's record source query criteria bound to the entered value in student ref, and then make bound a macro to the after_update event to try to add in a new record. If the field is PK then the macro will fail, else the macro will succeed, either way, the subform will go to the record...

if you want a quick and simple solution, have some code in the after_update event to test for the record, if exists, goto record, if not, insert new record, then goto it...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top