Odd, odd problem.

Crilen007

Uhm, Title... *shrug*
Local time
Today, 10:52
Joined
Jun 13, 2003
Messages
531
Created a Door Reg Database, basically

people come in the door, give their account number and guest names, badges get printed.

Simple right?

Well, when all the data is in, for the accounts and everything, when I add one customer, it works. WHen I add another, it tells me that someone else is also editing the record. I tried compact/repair, no help.

So, I empied all the data tables, created a few basic ones, with random data. It works... any ideas?

Maybe duplicate records? I don't see why it would give me that error for that though?

There is no linking to another database in this database.
Also, it is on my system, and I am the only one in it.
 
Removed duplicate customers, still not working.

I wish I could send someone the DB, but it has a lot of confidential data =(

(house numbers and what not.)
 
Also, the error comes up twice in a row, then it prints the badge ok.
 

Attachments

  • odderror.PNG
    odderror.PNG
    61.9 KB · Views: 126
There a way to get more details then that on the error?
What forms might be doing it? What part of code if any?
 
Ok, it appears that its related to the search field at the bottom.


If I take that subform off the main form, and make it its own form, and have it close before I print, it doesn't have that stupid error.
 
I still need that window to be part of the other one, or atleast not have to close it down each time.
 
when I add one customer, it works. WHen I add another, it tells me that someone else is also editing the record.

You have a recordset open somewhere when this happens. YOU are the "someone else" who is editing the record.

You say you have a search function. Does it perhaps do a "behind-the-scenes" search by doing stuff with a recordset not visible to the form?

Or did you add the new entry through a hidden recordset?

If so, close the recordset. Also try .requery on the recordset or .refresh on the form when you have finished printing your first badge.

There is also the chance that either the data search recordset or the form should have its locks modified. If the data search is a separate recordset, try to set no locks with that particular recordset.
 
YOU are the "someone else" who is editing the record. (haha, yea I guessed that, not a network database)

You say you have a search function. Does it perhaps do a "behind-the-scenes" search by doing stuff with a recordset not visible to the form?

(I will post the code)


The first 3 entries are 3 different searches for the same data.
Code:
Private Sub cboName_AfterUpdate()

Dim rst As dao.Recordset
Set rst = Me.RecordsetClone

On Error GoTo err_cboName
    rst.FindFirst "cust_nbr = " & cboName.Column(1)
    If rst.NoMatch Then
        MsgBox "Record Not Found", vbOKOnly, "No Match"
        Me.cboName = ""
    Else
        Me.Bookmark = rst.Bookmark
        Me.cboName = ""
        Me.cmdCopy.SetFocus
    End If
Exit Sub
err_cboName:
    Me.cboName = ""
    Me.cboName.SetFocus
End Sub
--------------------------------------------------
Private Sub cboPhone_AfterUpdate()

Dim rst As dao.Recordset
Set rst = Me.RecordsetClone

    On Error GoTo err_cboPhone
    rst.FindFirst "cust_nbr = " & cboPhone.Column(0)
    If rst.NoMatch Then
        MsgBox "Record Not Found", vbOKOnly, "No Match"
        Me.cboPhone = ""
    Else
        Me.Bookmark = rst.Bookmark
        Me.cboPhone = ""
        Me.cmdCopy.SetFocus
    End If
Exit Sub

err_cboPhone:
    Me.cboPhone = ""
    Me.cboPhone.SetFocus
End Sub
---------------------------------------------------
Private Sub cboCust_AfterUpdate()
    Dim rst As dao.Recordset
    Set rst = Me.RecordsetClone
    
    On Error GoTo Err_cboCust
        rst.FindFirst "[Cust_nbr] =" & Me.cboCust.Column(0)
            If rst.NoMatch Then
                MsgBox "No Customer No. Like this", vbOKOnly, "Customer Number"
                Me.cboCust = ""
                Me.cboCust.SetFocus
            Else
                'gcust = cboCust.Column(0)
                Me.Bookmark = rst.Bookmark
                Me.cboCust = ""
                'Me.cboCust.SetFocus
                Me.cmdCopy.SetFocus
            End If
            Exit Sub
            
Err_cboCust:
       Me.cboCust = ""
       Me.cboCust.SetFocus
       
End Sub
-----------This copies the info from the search to the main form -----------------------------------------
Private Sub cmdCopy_Click()
On Error GoTo cmdcopy_err
    Forms!frmdoorreg!cboAcctID = Me.txtCustNbr
    Forms!frmdoorreg!txtComName = Me.NAMElbl
    
    Forms!frmdoorreg!CUST_NAME = Left(Me.NAMElbl, 25)
    Forms!frmdoorreg!AcctID = Me.txtCustNbr
    Forms!frmdoorreg!Address1 = Me.Text29
    Forms!frmdoorreg!txtAddress1 = Me.Text29
    Forms!frmdoorreg!Address2 = Me.Text30
    Forms!frmdoorreg!txtAddress2 = Me.Text30
    Forms!frmdoorreg!City = Me.Text31
    Forms!frmdoorreg!txtCity = Me.Text31
    Forms!frmdoorreg!PC = Me.Text32
    Forms!frmdoorreg!txtPC = Me.Text32
    DoCmd.Close
    Forms!frmdoorreg.SetFocus
    Forms!frmdoorreg!CatID.SetFocus
Exit Sub

cmdcopy_err:
MsgBox "Press Clear Button first", vbInformation, "Door Registration"
End Sub
----------------------------------------------------------
Private Sub cmdPrevious_Click()
On Error GoTo Err_cmdPrevious_Click


    DoCmd.GoToRecord , , acPrevious

Exit_cmdPrevious_Click:
    Exit Sub

Err_cmdPrevious_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrevious_Click
    
End Sub
---------------------------------------------
Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click


    DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
    Exit Sub

Err_cmdNext_Click:
    MsgBox Err.Description
    Resume Exit_cmdNext_Click
    
End Sub
 
As The Doc Man stated before, you should close your recordset (and clear it).
You don't close neither clear your recordset in your code.
You need to include this in your code.

RV
 
I tried putting a rst.close before the exit sub. still errors.
 

Users who are viewing this thread

Back
Top Bottom