Form not auto-filling with data.

omegaleph

Registered User.
Local time
Today, 01:42
Joined
Jul 3, 2008
Messages
27
I have a database (inherited) and its now working well except for one form. You can open it and enter data and save/close it. But when you open it again, there is nothing there (whereas all the other forms show the current data).

The code is included below. I've done some debugging and found out that the code executes to the indicated line with curID having the proper value (i.e. "756.12" (our ids are text)). So it seems to be that line that's not working. There is, in fact, a form named Ascertainment (which opens but doesn't have data)

Code:
Private Sub cmdAscertainment_Click()
    Dim curID As String
    Dim recordExists As Boolean
    curID = Me![IDNUMBER]
    
    run = MainNavigate()
    If boolCancel = True Then
        Exit Sub
    Else
        If run = False Then
            DoCmd.Close acForm, Me.Name
            Exit Sub
        Else
            recordExists = FindRecord("Ascertainment", "IDNUMBER", curID)
            If recordExists Then
                DoCmd.OpenForm "Ascertainment", , , "[IDNUMBER] = """ & curID & """" '<-this line
            Else
                DoCmd.OpenForm "Ascertainment", , , , acFormAdd
                [Forms]("Ascertainment")![txtIDNUMBER] = curID
            End If
        End If
    End If
End Sub
 
Try changing the line to:
DoCmd.OpenForm "Ascertainment", , , "[IDNUMBER] = """ & curID & """",acFormEdit
 

Users who are viewing this thread

Back
Top Bottom