Cant find ID unless all Combo Boxes have value.

vapid2323

Scion
Local time
Today, 15:14
Joined
Jul 22, 2008
Messages
217
This is a new one for me,

I have a simple line of code to open a audit log

Code:
DoCmd.OpenForm "frmAuditHistoryDetail_Audit", , , "[AuditHistoryID] = " & Me.AuditHistoryID.Value

The button is found on a continuous subform, and just allows the user to see a audit history for the selected record.

My problem is that this subform has two optional combo boxes, and if even one is not populated the above code will not find the correct record and just show an empty form.

I can go find the records by hand (they really are in the table) and also if the combo boxes are filled in the subform the above code will find the correct record and everything works as planned.

Anyone run into this type of issue?
 
...
My problem is that this subform has two optional combo boxes, and if even one is not populated the above code will not find the correct record and just show an empty form.
....

Just a wag (1), but I'm guessing that the data-source for the form is based on a query.

If so, I'd further guess that the query join-type requires all the joins to have a matching value.

If so, the fix would be to revise the join-type on the query.

(wag: wild assumption guess)
 
Just a wag (1), but I'm guessing that the data-source for the form is based on a query.

If so, I'd further guess that the query join-type requires all the joins to have a matching value.

If so, the fix would be to revise the join-type on the query.

(wag: wild assumption guess)

You might be on to something! I will play around with this.
 
My combo boxes use the following query to lookup values:

Code:
SELECT [TypeOfAuditID], [TypeOfAudit] FROM [tblTypeOfAudit] ORDER BY [TypeOfAudit]

So the tracked value would only be the ID, also I checked the subform and its based on a table not a query...

I guess my thought is why do the combo boxes have any effect, they are not involved with the lookup outside the fact that they hold a value :(

I dont get whats wrong with this one lol
 
What is the record source of the form you are opening? Is it set to the table, a query, or SQL Statement?
 

Users who are viewing this thread

Back
Top Bottom