-----Original Message-----
No I never did get the "copy" option to work. Then the
autonumber problem occurred.
I have two forms: the first form called SelectName
contains only an unbound combo box called SalesRep. The
user selects their name from the combo box then clicks
a "Continue" button. The "On Click" event on my "continue"
button runs a macro. This macro opens a form
called "Schedule Data Entry" where SlsRepID = [Forms]!
[Schedule Data Entry]![SalesRep].
The list box located at the bottom of form "Schedule Data
Entry" lists all the travel/activities for the user. If
the user clicks on any one of the records listed in the
listbox called "list53" the individual record can be
edited on the form (upper half of form). The user has
command buttons on this form that add a record, delete a
record, update/refresh, cancel.
The next autonumber in the Activity table is 513; however,
the "add new activity" button is trying to assign an
available autonumber (270) to the record based on the
filtered records in the listbox. I need it to assign the
next autonumber (513) based on the table NOT the listbox.
My users like the way the form works - ability to see all
their entries in the list box, edit, update and add
records all on one screen.
Here's my code associated with this form:
Private Sub cboDate_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
With Calendar1
.Visible = Not .Visible
If .Visible Then
.SetFocus
.Value = Date
Else
cboDate.SetFocus
End If
End With
End Sub
---------------------------------
Private Sub Calendar1_Click()
With Calendar1
cboDate.Value = .Value
cboDate.SetFocus
.Visible = False
End With
End Sub
-----------------------------------
Private Sub cmdUndo_Click()
' same action as clicking Undo from the Edit menu
DoCmd.RunCommand acCmdUndo
Requery
End Sub
Private Sub Form_Current()
Me!CmdUndo.Enabled = False
End Sub
Private Sub Form_Dirty(Cancel As Integer)
Me!CmdUndo.Enabled = True
End Sub
-----------------------------
Private Sub List53_AfterUpdate()
' Find the record that matches the control.
Dim RS As Object
Set RS = Me.Recordset.Clone
RS.FindFirst "[Activity_ID] = " & Str(Me![List53])
Me.Bookmark = RS.Bookmark
End Sub
-------------------------
Private Sub CmdAddActivity_Click()
On Error GoTo Err_CmdAddActivity_Click
DoCmd.GoToRecord , , acNewRec
Exit_CmdAddActivity_Click:
Exit Sub
Err_CmdAddActivity_Click:
MsgBox Err.Description
Resume Exit_CmdAddActivity_Click
End Sub
----------------------------
Private Sub CmdDelActivity_Click()
On Error GoTo Err_CmdDelActivity_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70
Exit_CmdDelActivity_Click:
Exit Sub
Err_CmdDelActivity_Click:
MsgBox Err.Description
Resume Exit_CmdDelActivity_Click
Requery
End Sub
-------------------------
Private Sub cmdUpdateScreen_Click()
On Error GoTo Err_cmdUpdateScreen_Click
DoCmd.GoToRecord , , acLast
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, ,
acMenuVer70
Exit_cmdUpdateScreen_Click:
Exit Sub
Err_cmdUpdateScreen_Click:
MsgBox Err.Description
Resume Exit_cmdUpdateScreen_Click
End Sub
-----Original Message-----
Jody,
Did you get that problem fixed last week? I hope I was
able to help!
It sounds to me like when they enter their name, the form
is trying to create a new record. Not sure why without
more information.
Is the form bound? If so, you need another form that will
allow the user to enter their name, then open the form
filtered or apply a filter if it's already open based on
the choice made in the other form.
I have also handled this by use of a hidden form. In the
after update event I set the value of a field on a hidden
form to the vaslue of the field and apply the filter based
on the field on the hidden form.
If the form is not bound, I would need more information on
how your retrieving records.
Hope that helps!
Kevin
-----Original Message-----
I posted my question earlier but I need a response
ASAP -
-
my users are up in arms! Any suggestions please?
-------------------------------------------
I ran compact/repair but it still doesn't work. It may
be
the way I have my data entry forms set up.
When the user first opens the data entry screen they are
prompted to enter their name from a drop down box. They
then click a "next" button to take them to the main data
entry screen. This screen will show all their
travel/activity entries in a list box at the bottom of
the
screen. When they click on any item in the list box,
they
can edit it the form at the top of the screen. I have a
button that will allow them to add a new activity.
What may be happening is that it tries to assign the next
autonumber based on the records in the listbox rather
than
the entire table. How do I get the "add new activity" to
work properly by taking out the next autonumber in the
table yet still show only the selected users activities
in
the listbox?
Thanks for your help.
Here's my listbox code:
Private Sub List53_AfterUpdate()
' Find the record that matches the control.
Dim RS As Object
Set RS = Me.Recordset.Clone
RS.FindFirst "[Activity_ID] = " & Str(Me![List53])
Me.Bookmark = RS.Bookmark
End Sub
-----Original Message-----
Sounds like a corruption problem to me.
Make a copy of your back end database just in case,
then run compact/repair on the original.
Chances are good that will take care of it, but if
it
doesn't, post
back.
HTH
- Turtle
message
My database has linked tables. I have 10 users that
have
a copy of the database on each of their computers. The
main tables reside in a shared department area on our
network. We "split" the database in order to allow
more
than one individual to have the data entry forms open
at a
time.
It seemed to be working but I recently noticed that
when a
new record is added, instead of the system assigning
the
next autonumber in the table (Activity_ID is my primary
key and autonumber field) which in this case should be
513, it tries to assign a 270 which already exists and
I
get the following error message:
"The changes you requested to the tabe were no
successful
because they would create duplicate values in the
index,
primary key or relationship...."
I thought it should automatically put the next number
on
the record.
Here's my code to add the new record.
Private Sub CmdAddActivity_Click()
On Error GoTo Err_CmdAddActivity_Click
DoCmd.GoToRecord , , acNewRec
Exit_CmdAddActivity_Click:
Exit Sub
Err_CmdAddActivity_Click:
MsgBox Err.Description
Resume Exit_CmdAddActivity_Click
End Sub
I fairly new to VB and not sure what's happening ....
any
suggestions?
.
.
.