Solved

How open form if only one record exists in query?

Posted on 2013-11-14
2
424 Views
Last Modified: 2013-11-14
I'm using the onopen event of a form to determine if a second form should open right to a record.  

Here is my code which isn't anywhere near right I'm sure.  Can someone help?

Private Sub Form_Open(Cancel As Integer)

    Dim recordcount As Integer
    If recordcount = 1 Then
        DoCmd.OpenForm "frmIndividuals", acNormal, , "[IndividualID]=" & Me.txtIndividualID, acFormEdit, acWindowNormal
    End If

End Sub
0
Comment
Question by:SteveL13
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39649099
Try

Me.recordsetclone.movelast
If me.recordsetclone.recordcount =1 then
   Etc
End if
0
 

Author Comment

by:SteveL13
ID: 39649144
Perfect!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question