Re: Query gets first record value only
Try using the Current Event of the form. It fires after record navigation.
In this event simply requery the combo:
me.myCombo.requery
--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
ScottB0013 wrote:
> Hi all, I have a query that accepts criteria from a combo box on my
> main form. The SQL looks like this:
>
> SELECT [Wedding Dates].WeddingDateID, [Wedding Dates].Date, [Wedding
> Dates].Time, [Date] & " " & " " & [Time] AS [Combined DateTime],
> Bride.WeddingDateID, Bride.WeddingDateID
> FROM [Wedding Dates] LEFT JOIN Bride ON [Wedding
> Dates].WeddingDateID=Bride.WeddingDateID
> WHERE (((Bride.WeddingDateID)=Forms!Contacts![Wedding Date])) Or
> (((Bride.WeddingDateID) Is Null))
>
> The purpose of this query is to limit the records in the combo box to
> ones that are available (i.e. Null values in the foreign key) but
> also display the combo-box value for the current record (the first
> part of the WHERE clause).
>
> The problem is that when I go to the form, the query appears to be
> only executing for the first record that displays. When I navigate to
> other records, the combo box does not display the Combo box value
> even though I know it is set in the dbase table.
>
> Is there a way to make this query re-execute each time I navigate to
> a new record? I think if I could make it pass the new parameter each
> time I navigate to a different record, the query would work perfectly.
>
> If there's a better way to do this, I'm certainly open to suggestions.
> Thanks very much for your help!
.
Relevant Pages
- Re: combo boxes
... If you used a query it is possible to have designed the query to not allow ... Does your subform display data from the same table as you main form? ... Subforms are usually used to display data in a separate table ... >> navigate to the last record and then once more to go to a new record. ... (microsoft.public.access.forms) - Re: Parenthasis issue
... Press Ctrl+G to navigate to the Immediate window ... Navigate to the Documenter ... Click the Queries tab and select the problematic query ... an extra closing parenthasis ")". ... (microsoft.public.access.queries) - Re: Record navigation with Paging
... should be able to navigate with single record, ... So i would like to build the custom ... DataView to accomodate these requirement. ... >> I was looking the msdn sample:(Paging through a query ... (microsoft.public.dotnet.framework.adonet) - Re: Export like a Save As
... > acExport" for exporting a Query but emulating a Save As. ... > the PopUp form allows the user to navigate into his or her ... (microsoft.public.access.formscoding) - Records displayed when opening form...!!!
... This problem only occurs when the query that I'm using has a primary key ... When I use a query without a primary key field, the form opens with no data ... field to not display the first record when I open the form...??? ... (microsoft.public.access.forms) |
|