Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    8

    Unanswered: form not opening visible

    still working on my little DAR Tracking project. i think that i have this coded correctly. i did have the form so that it would open but it opened behind the form that i am using. so you can't edit or add new records to this part of the database which is a leasons learned database. here is my code:

    Dim sql As String
    Dim DBleason As DAO.Database
    Dim RstLL As DAO.Recordset
    Dim mynum As String

    mynum = Me.RefNum
    If LeasonLearned = "Y" Or LeasonLearned = "y" Then
    Set DBleason = CurrentDb()
    sql = "SELECT [Leasons Learned].[DarNumber]" _
    & "FROM [Leasons Learned]" _
    & "WHERE [Leasons Learned].[DarNumber]=' & mynum & ';"
    Set RstLL = DBleason.OpenRecordset(sql)

    If Not RstLL.EOF Then
    DoCmd.OpenForm "LeasonLearnedForm", , , , acFormEdit
    Forms!LeasonLearnedForm.Visible = True
    Else
    DoCmd.OpenForm "LeasonLearnedForm", , , , acFormAdd
    Forms!LeasonLearnedForm.Visible = True

    End If
    End If
    RstLL.Close
    DBleason.Close
    Set RstLL = Nothing
    Set DBleason = Nothing

    what i want to happen is if you don't find the refnum in the database set the form so it will open to add a new record if it is found then set that record so it can be edited. refnum is a number field

    Thanks in advance

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    If the form is opening behind the already open form, my guess would be that the popup and/or modal properties of the already open form aren't set correctly. As to opening the new form to edit the record:

    Open a second form to the record
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •