Solved

How open form if only one record exists in query?

Posted on 2013-11-14
2
425 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

726 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