Hello All
First of all, I am totally hopeless in writing SQL correctly in VBA.
I will try and be as descriptive as I can possible be and attempt to use the correct terminology and correct VBA functions! ;-)
What I am attempting is populating a unbound list box (listRECORDS) on a form that populates using SQL on form Load
The form is frmMAIN and the source is tblMAIN
There is another table and the table is tblRECORDS
I am not sure if I should use If Then Else OR Case
I would also like to keep it as simple as I can and add to it as I learn.
Ok, I would like to see how this is formated and done in VBA Access:
Thanks in advanced!
First of all, I am totally hopeless in writing SQL correctly in VBA.
I will try and be as descriptive as I can possible be and attempt to use the correct terminology and correct VBA functions! ;-)
What I am attempting is populating a unbound list box (listRECORDS) on a form that populates using SQL on form Load
The form is frmMAIN and the source is tblMAIN
There is another table and the table is tblRECORDS
I am not sure if I should use If Then Else OR Case
I would also like to keep it as simple as I can and add to it as I learn.
Ok, I would like to see how this is formated and done in VBA Access:
Code:
Dim MyLameSQL As String MyLameSQL = "SELECT * FROM [tblRECORDS] From tblRECORDS IF tblRECORDS.recordid is not zero and matches forms!frmMAIN!cboPerson Then Add it to MyLameSQL IF tblRECORDS.Recordid2 is not zero and matches forms!frmMAIN!cboPerson2 Then Add it to MyLameSQL IF tblRECORDS.Recordid3 is not zero and matches forms!frmMAIN!cboPerson3 Then Add it to MyLameSQL Me.listRECORDS.RowSource = MyLameSQL Me.listRECORDS.Requery
Comment