Solved

How open form if only one record exists in query?

Posted on 2013-11-14
2
420 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
Comment Utility
Try

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

Author Comment

by:SteveL13
Comment Utility
Perfect!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now