Hi,
I have a question when I set flag for the form.
I have two forms: one is called Entryform and the other is called SearchForm.
The Entryform shows all the records in the table Maintable; this form is set to an empty record when the form is open.
The SearchForm retrieves the records which only meet certain criteria and it shows the ID of the records. When the ID is clicked,
the EntryForm is open and the data about the record should be showned.
My problem is that when the ID is clicked in the SearchForm, the empty record is showed first instead. I have to click <| button at bottom of the form to see the record which should be display.
To solve this problem, I created a public variable called flag to check if it is in the SearchForm or just Open EntryForm.
In the SearchForm, my code for ID_Click() is
DoCmd.OpenForm "Log Entry Form", , acFormReadOnly, "ID=[forms]![search_form]![ID]"
flag = True
In the EntryForm, the code for Open_Form() is
If flag = True Then
flag = False
Else
DoCmd.GoToRecord , , acNewRec
End If
However, it doesn't work. Anyone knows how to solve this problem? Thanks!
I have a question when I set flag for the form.
I have two forms: one is called Entryform and the other is called SearchForm.
The Entryform shows all the records in the table Maintable; this form is set to an empty record when the form is open.
The SearchForm retrieves the records which only meet certain criteria and it shows the ID of the records. When the ID is clicked,
the EntryForm is open and the data about the record should be showned.
My problem is that when the ID is clicked in the SearchForm, the empty record is showed first instead. I have to click <| button at bottom of the form to see the record which should be display.
To solve this problem, I created a public variable called flag to check if it is in the SearchForm or just Open EntryForm.
In the SearchForm, my code for ID_Click() is
DoCmd.OpenForm "Log Entry Form", , acFormReadOnly, "ID=[forms]![search_form]![ID]"
flag = True
In the EntryForm, the code for Open_Form() is
If flag = True Then
flag = False
Else
DoCmd.GoToRecord , , acNewRec
End If
However, it doesn't work. Anyone knows how to solve this problem? Thanks!