Someday I will learn to code. I need a class and I live in the middle of
nowhere, so no classes.
So here is what I put in the VB window and checked it with debug/compile and
then saved it.
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frmVestryPastCurrent", WhereCondition:="Current = True"
End Sub
That part worked, which is a first for me. When I open the form I get a
Parameter Dialog box that is labled Current. Guess it gets that from
..."Current = True"... the form opens (YEAH!!!) and all 9 test records appear.
So I have created an event procedure that opens the form with some
condition. I am lost as to what to do about the condition and also how does
the code know what two fields I want to choose from and how do I enter them?
I am sorry. I know this is probably vb 101 for dummies, but I do not know
how to do these things. I keep hoping if I read enough posts and read enough
code snippets of what people are tryng to do that I will eventually
understand it. But not yet. This is how I learned to use expressions.
qryVestryPastCurrent from tblPerson & tblVestry
SQl for query=
SELECT tblPersonal.first, tblPersonal.middle, tblPersonal.last,
tblVestry.pastMember, tblVestry.currentMember, [first] & " " & [middle] & " "
& [last] AS Name
FROM tblPersonal INNER JOIN tblVestry ON tblPersonal.personKEY =
tblVestry.nameSubKEY;
What do I replace current with in event procedure and how does code know
what to do to the form?
I don't know for sure, because I don't know how your database is structured.
Are the fields pastMember and currentMember checkboxes of which one will be
checked? If so, then use a wherecondition of
currentMember = True
instead of Current.
IF that is the case though... you have a design flaw. The two fields are
redundant, in that *logically* only one can be true, and the other must be
false. But there's nothing in the structure of the table that prevents both
from being false (that is, a person is neither a current member nor a past
member, yet is a member); or both being true (The Once and Future King...?)
Better would be a single yes/no field which is True for a current member,
False for a past one.