How do I open one Access form at a time?

candyA25

New member
Local time
Today, 05:49
Joined
Jun 26, 2013
Messages
9
[SOLVED] How do I open one Access form at a time?

I have two forms set to open if the queries listed below have existing records and the SyncData button is clicked.

What I want to happen is this: if the first query has records, open the form. After the user is done with this form, if records exist in the second query, the frmMyMedDataSelect form needs to display next. Right now, both forms display at the same time if each query has records.

Code:
Private Sub SyncData_Click()
    MedDataQuery
End Sub

Public Sub MedDataQuery()
    If DCount("*", "qryMedDataSelect") > 0 Then
        DoCmd.OpenForm "frmMedDataSelect"
    End If
    
    If DCount("*", "qryMyMedDataSelect") > 0 Then
        DoCmd.OpenForm "frmMyMedDataSelect"
    Else
        'sync module
        SyncDataSwine
    End If

Exit_MedDataQuery_Click:
    Exit Sub

Err_MedDataQuery_Click:
    MsgBox Err.Description
    Resume Exit_MedDataQuery_Click
End Sub
 
Last edited:
I would put the code to open the second form in the close event of the first form
 

Users who are viewing this thread

Back
Top Bottom