A
Al
How can I make a sub form go a record based on the selection made in a list
box in the main form?
thanks
box in the main form?
thanks
Al said:How can I make a sub form go a record based on the selection made in a list
box in the main form?
Marshall Barton said:Al said:How can I make a sub form go a record based on the selection made in a list
box in the main form?
Here's one way to do that using the list box's AfterUpdate
event:
With Me.yoursubformcontrolname.Form.Recordset
.FindFirst "[your PK field] = " & Me.[thelistboxname]
End With
Marshall Barton said:Al said:How can I make a sub form go a record based on the selection made in a list
box in the main form?
Here's one way to do that using the list box's AfterUpdate
event:
With Me.yoursubformcontrolname.Form.Recordset
.FindFirst "[your PK field] = " & Me.[thelistboxname]
End With
Dale Fye said:Marshall,
If you "know for certain" that there is a record in the subform that matches
the value you are looking for this works great.
But if you are not sure, and the FindFirst method doesn't find the value you
are looking for, it moves the record pointer off of the record that was
currently selected in the subform to the first record in the subform.
I'm not sure I would want that result.
Dale
--
Don''t forget to rate the post if it was helpful!
email address is invalid
Please reply to newsgroup only.
Marshall Barton said:Al said:How can I make a sub form go a record based on the selection made in a list
box in the main form?
Here's one way to do that using the list box's AfterUpdate
event:
With Me.yoursubformcontrolname.Form.Recordset
.FindFirst "[your PK field] = " & Me.[thelistboxname]
End With
Dale said:Marshall,
If you "know for certain" that there is a record in the subform that matches
the value you are looking for this works great.
But if you are not sure, and the FindFirst method doesn't find the value you
are looking for, it moves the record pointer off of the record that was
currently selected in the subform to the first record in the subform.
I'm not sure I would want that result.