Select queries and Union queries

nadsys

Registered User.
Local time
Today, 01:38
Joined
Apr 22, 2005
Messages
18
i have a table named "products" with fields "MDateID", "MaintDate", "PSSID", "LogEntry", "UpdatesPerformed", "configurationChange", "comment"

i have two combo box's which user selects an entry from the PSSID, then the next comboBox allows them to select the MaintDate for that PSSID choice. From there it then displays LogEntry,updatesperformed into text box's on same form.

i have tried it two ways, one with bound text box, one with unbound. neither worked.

my select statement in combo box is this:
SELECT distinct Products.MDateID, Products.MaintDate FROM Products WHERE (((Products.PSSID)=[forms]![frmComboTest]![PSSID])) UNION select distinct null, null FROM Products ORDER BY Products.MaintDate;

i have the VB code as this:
Private Sub MDateID_AfterUpdate()
Me.txtLog.Value = Me.MDateID.Column(2)
End Sub

Private Sub PSSID_Change()

MDateID.Value = Null
MDateID.Requery

End Sub

Private Sub Form_Current()

MDateID.Requery

End Sub

it only works when i select column 0 or column 1 (0 displays mdateid, 1 displays the date, as there the fields 0 and 1 in my table, i cant choose column 2/3/4 etc, it returns just an empty box if i do. confused.

i also tried adding in extra lines to my select statement such as:
select distinct Products.MDateID, Products.MaintDate, Products.LogEntry..... but then i get nothing in the second combo box showing at all.

not experienced with anything in access, reading a lot but this is baffling me.

thank you for your patience. program is attached
 

Attachments

ignore

managed to get it done by using the "..." next to rowsource instead of manually typing it in, why it matters i have no idea cos line looks same as mine was but it now works so go figure.
 

Users who are viewing this thread

Back
Top Bottom