Open Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a series of forms that open for a user to complete various fields of
an incomplete record. (i.e. Time, Date) However, I do not want the form to
display if there the record is complete. Can I somehow say if the query
returns nothing, do not open the form?
 
The following works when the user clicks a button. Each form has similar
code to open the next form and close the current. I was thinking if I could
somehow run the query and say if nothing returns open the next form, else do
the following, but not quite sure of the syntax.

Dim stAdmitDate As String
Dim stConcurren As String

stAdmitDate = "frmAdmitDate"
stConcurren = "frmConcurren"

DoCmd.OpenForm stAdmitDate
DoCmd.Close acForm, stConcurren
 
You could perhaps use the DLookup function to determine if the data exists.
Something like this:

If IsNull(DLookup("myFieldName", "myTableName", "MyFieldName = '" &
myLocalVariable & "'") ) Then
DoCmd.OpenForm stAdmitDate
Else
'Do something else
End If

Look in Access help for details about the DLookup function.

Barry
 
Worked GREAT....thank you!!!

Barry Gilbert said:
You could perhaps use the DLookup function to determine if the data exists.
Something like this:

If IsNull(DLookup("myFieldName", "myTableName", "MyFieldName = '" &
myLocalVariable & "'") ) Then
DoCmd.OpenForm stAdmitDate
Else
'Do something else
End If

Look in Access help for details about the DLookup function.

Barry
 

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

Back
Top