Autocounter

  • Thread starter Thread starter an
  • Start date Start date
Here's a simpler piece of code which I've tested with both On Load and
OnOpen:

Function CountOpen()
On Error GoTo Error_Handler

Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("tblDBOpen", dbOpenDynaset)

With rst
rst.MoveFirst
rst.Edit
rst!CountDB = rst!CountDB + 1
rst.Update
End With

Exit_Here:
On Error Resume Next
rst.Close
Set rst = Nothing
Set db = Nothing
Exit Function

Error_Handler:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here

End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Sorry, AM

With this code no problem.

The problem is with expression
= CountOpen()

When form open, return:
! Compile error: Sintax error

Thanks
an
 
Sorry.

4th position:
Visual Basic For Applications
Microsoft Access 12.0 Objecto Library
OLE Automation
Microsoft DAO 3.6 Object Library

SO: WindowsXP
Acc: 2k7

an
 
Look at the URL in my sig. At that website is my email address. Compact and
zip your database and email it to me. I'll figure out what you are having a
problem with. Before you send the database, send an email with your full
name and email address and the subject: "Re: Autocounter" I need to
whitelist you or your attachment email will be automatically deleted.
 
Ok, AM.

Any bug, eventually.
We have checked another bugs and informed the Microsoft.
Ex:
Me.xxx vrs Me!Xxx; One blank space after last character when import Excel
spreadsheet; Etc.

Thank you so much.
an
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Update combo in open form 2
Requery 5
"Empty" textboxes 5
Isn't possible? 4
Add criteria to a append query 2
Autocounter!! 4
form based on three table query 2
Count records from form where txtbox="ABC" 2

Back
Top