I'm using Access 2003 and I'm trying to get a field on one form to output data based on a query that is partly based on the user's selection.
Basically, user chooses option which makes option either 1 or 2. User then clicks cmdSubmit and it loads a different form that iniates a query to populate a field based on whether or not the option is a 1 or a 2.
I have passed the value and have the correct data appearing in the correct field, but it's not sorted. The table, where the data pulls from, is sorted, but for some reason when I use ORDER BY, I keep getting error messages.
Here's the code for cmdSubmit:
And here's the code for the form load:
I have tried placing ORDER BY tblprogram.prog ram after the FROM statement and also separately after me.openargs. Obviously I'm missing something somewhere.
Any ideas??
Basically, user chooses option which makes option either 1 or 2. User then clicks cmdSubmit and it loads a different form that iniates a query to populate a field based on whether or not the option is a 1 or a 2.
I have passed the value and have the correct data appearing in the correct field, but it's not sorted. The table, where the data pulls from, is sorted, but for some reason when I use ORDER BY, I keep getting error messages.
Here's the code for cmdSubmit:
Code:
Private Sub cmdSubmit_Click()
Dim UserChoice As Variant
UserChoice = [optionGroup].Value
DoCmd.OpenForm "frmEmployee", acNormal, , , acFormAdd, , UserChoice
DoCmd.Close acForm, Me.Name
End Sub
Code:
Private Sub Form_Load()
Dim UserChoice As Variant
Program.RowSourceType = "Table/Query"
Program.RowSource = "SELECT * FROM tblProgram WHERE ProgramID = " & Me.OpenArgs
End Sub
Any ideas??
Comment