NewRecord Code

  • Thread starter Thread starter martha.dempsey
  • Start date Start date
M

martha.dempsey

I am trying to create a new record and can't understand
why this code doesn't work. Can you tell me why this is
not working?


Private Sub Form_Current()
End Sub
Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer

intnewrec = frm.NewRecord
If intnewrec = True Then
MsgBox "You're in a new record." _
& "@Do you want to add new data?" _
& "@If not, move to an existing record."
End If
End Sub

Thanks!
martha
 
I am trying to create a new record and can't understand
why this code doesn't work. Can you tell me why this is
not working?


Private Sub Form_Current()
End Sub
Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer

intnewrec = frm.NewRecord
If intnewrec = True Then
MsgBox "You're in a new record." _
& "@Do you want to add new data?" _
& "@If not, move to an existing record."
End If
End Sub

Thanks!
martha

How do you call this "NewRecordMark" subroutine of yours? Where are you
calling it from, and what are you passing in the "frm" argument?

BTW, are you using Access 97? The MsgBox formatting with "@" signs
won't work in Access 2000 or later.
 
Well, you need to call your NewRecordMark sub from the
Form_Current.

Also note, the @'s only work in Access 97 Message Boxes.

Private Sub Form_Current()
NewRecordMark Me
End Sub
Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer

intnewrec = frm.NewRecord
If intnewrec = True Then
MsgBox "You're in a new record." _
& "@Do you want to add new data?" _
& "@If not, move to an existing record."
End If
End Sub



Chris
 
I have Access 2000. I took the @ out and the msgbox work
but now I can't get passed an error message on my indexes
therefore it will not let me get passed the new record.

How many indexes can you have? Mine are mostly Yes
Duplicates Ok. Any suggestions?

md
 
There is a limit to how many indexes you can have, in
Access 2000 its: 32 per table


But, you want to keep indexes to a minimum if you are
doing updates. Each update has to update each index, and
that can be lenghty depending on the operation.

What error are you getting?

Chris Nebinger
 
My error msg is:
The changes you requested to the table were not successful
because they would create duplicates values in the index,
primary key, or relationship. Change the data in the
field or fields that contain duplicate data, remove the
index, or redefine the index to permit duplicated entries
and try again.

I only have 1 table therefore I don't think the
relationship is the problem. The primary key is Yes, no
duplicates.

Hoping to isolate the specific field(s), I have changed
the data in all the fields so no duplications are
present. Only my option groups (OGs) contains yes and no
check boxes with 1 and 2 as the values.

If it is the OGs, how do I get around it?
thanks!
martha
 
Thanks Chris! I re-reseached indexes and found where the
table index was defined and I had too many (index icon) I
remove fields down to 32 and its working!
martha
 
Back
Top