#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0

    problems inserting records


    i have made a form called Employee Data which is mainly for calculations of number values. when i open the form, it seems that a record is automatically created. in my other forms, the records start at "0" even though it says record 1 of 1. In the other forms i can press a new record button and the recordset remains to 1 of 1 if it is empty. in this form, i should be able to press a button for new record and that new record should be "1". instead when i press the button for the new record, it jumps to record "2". also, when i scroll through the records, i have to press the < or > buttons twice each to move to the previous or next record. it seems that 2 records are created for each id. (one default and one by user). it's kind of weird so i don't know too much more about it. what is going on??? please help!

    ameen
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    you need to show what you are doing in the form code-wise.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0
    well i am letting the access default handle what happens when a form loads. all of my other forms work, but in this particular one, a record gets created when the form loads. that is why when i try to add a record when nothing is populating the recordset it jumps to record #2 instead of going to record one. the other forms i can go to record #1 when i click on an add record button that i created. i have nothing in the form load property either. also when i try to delete an entry, new records get created. when i select records new records get created also. here is the code for the form:

    cheers!

    Option Compare Database

    Private Sub Add_Quarter_Click()
    On Error GoTo Err_Add_Quarter_Click
    Dim valquarter As Integer

    valquarter = New_Total.Value

    If CurrentRecord <= "3" Then
    DoCmd.GoToRecord , , acNewRec
    Quarter.Value = CurrentRecord
    Last_Quarter_Total = valquarter
    Else
    MsgBox "Only 4 Quarters in a Year!"
    End If

    If CurrentRecord = "1" Then
    Month.Value = "Jan-March"
    End If
    If CurrentRecord = "2" Then
    Month.Value = "Apr-Jun"
    End If
    If CurrentRecord = "3" Then
    Month.Value = "Jul-Sep"
    End If
    If CurrentRecord = "4" Then
    Month.Value = "Oct-Dec"
    End If

    Exit_Add_Quarter_Click:
    Exit Sub

    Err_Add_Quarter_Click:
    MsgBox Err.Description
    Resume Exit_Add_Quarter_Click

    End Sub



    Private Sub Last_Quarter_Total_LostFocus()
    Total_Quarter.Value = (Last_Quarter_Total.Value + New_Quarter.Value)
    New_Total.Value = (Total_Quarter.Value - Left_Quarter.Value)
    End Sub



    Private Sub Left_Quarter_LostFocus()
    New_Total.Value = (Total_Quarter.Value - Left_Quarter.Value)
    End Sub

    Private Sub New_Quarter_LostFocus()
    Total_Quarter.Value = (Last_Quarter_Total.Value + New_Quarter.Value)
    New_Total.Value = (Total_Quarter.Value - Left_Quarter.Value)
    Total_Race.Value = New_Quarter.Value
    Total_Age.Value = New_Quarter.Value
    Total_Gender.Value = New_Quarter.Value
    End Sub

    Private Sub Previous_Quarter_Click()
    On Error GoTo Err_Previous_Quarter_Click


    DoCmd.GoToRecord , , acPrevious

    Exit_Previous_Quarter_Click:
    Exit Sub

    Err_Previous_Quarter_Click:
    MsgBox Err.Description
    Resume Exit_Previous_Quarter_Click

    End Sub
    Private Sub Next_Quarter_Click()
    On Error GoTo Err_Next_Quarter_Click




    DoCmd.GoToRecord , , acNext

    Exit_Next_Quarter_Click:
    Exit Sub

    Err_Next_Quarter_Click:
    MsgBox Err.Description
    Resume Exit_Next_Quarter_Click

    End Sub


    Private Sub delete_quarter_Click()
    On Error GoTo Err_delete_quarter_Click


    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

    Exit_delete_quarter_Click:
    Exit Sub

    Err_delete_quarter_Click:
    MsgBox Err.Description
    Resume Exit_delete_quarter_Click

    End Sub
    Last edited by bogglebeats; March 17th, 2003 at 02:49 PM.
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    I can't see right off hand why it is doing this, but I would recommend that you set a breakpoint in your code and walk through it keeping an eye out for what is going on in the back-side of it.

IMN logo majestic logo threadwatch logo seochat tools logo