updating records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a simple form from a table and it will not allow duplicate SS# which
is what i want. however when i use the form i want to be able to edit a SS#
already in the table and when i enter the SS# in the form and then hit find i
get a duplicate error.
 
Bronson said:
i have a simple form from a table and it will not allow duplicate SS#
which is what i want. however when i use the form i want to be able
to edit a SS# already in the table and when i enter the SS# in the
form and then hit find i get a duplicate error.

Why would you think typing a SS# on an existing record would take you to a
different record? What you are doing is changing the existing record so its SS#
value is the same as some other record and the database is correctly telling you
that you can't do that.
 
I apoligize i need to pull that SS# up to edit data on that record. and if
the SS# is not in the table then it will allow me to add the record.
 
Bronson said:
I apoligize i need to pull that SS# up to edit data on that record.
and if the SS# is not in the table then it will allow me to add the
record.

A control can be used to ENTER the SS# or to FIND a specific SS#. You cannot
use the same control to do both. Which is it that you want to do?
 
i need one to find, i suppose and will leave the form i have now to enter. I
should be able to just make a copy of the current form correct and use it as
an modify form.
 
Bronson said:
i need one to find, i suppose and will leave the form i have now to
enter. I should be able to just make a copy of the current form
correct and use it as an modify form.

Just add an additional TextBox labelled GoTo... In its AfterUpdate event have
code...

Me.Filter = "[SS#] = '" & Me![GoTo] & "'"
Me.FilterOn = True

If the entry exists the form will display it. If not the new record position
will be displayed so you can make a new record.
 
getting an error stating no macro for this function

Rick Brandt said:
Bronson said:
i need one to find, i suppose and will leave the form i have now to
enter. I should be able to just make a copy of the current form
correct and use it as an modify form.

Just add an additional TextBox labelled GoTo... In its AfterUpdate event have
code...

Me.Filter = "[SS#] = '" & Me![GoTo] & "'"
Me.FilterOn = True

If the entry exists the form will display it. If not the new record position
will be displayed so you can make a new record.
 
Bronson said:
getting an error stating no macro for this function

The code does not go directly into the property box. You enter [Event
Procedure] in the box and then press the build button [...] to the right. That
will take you to the vba code window and that is where you place that code.
 
Just want to make sure i read this right. I got it to modify but it will not
add a new record. Is this where i will have to use another form to add
entries?

Rick Brandt said:
Bronson said:
getting an error stating no macro for this function

The code does not go directly into the property box. You enter [Event
Procedure] in the box and then press the build button [...] to the right. That
will take you to the vba code window and that is where you place that code.
 
Bronson said:
Just want to make sure i read this right. I got it to modify but it
will not add a new record. Is this where i will have to use another
form to add entries?

Applying a filter that returns no matched will not "create" a new record, but it
should position the form at the new record position so you can make the entry.
 
Back
Top