I am working in Access 2007. And I am an extreme newbie to Access.
I have 3 tables:
User
ID FirstName LastName
Program
ID ProgramName
ProgramUserXRef
ID UserID ProgID
My form consists of an unbound ComboBox whose Row Source is the User table. I added an Option group that displays the Programs. I want the default for this group to come from the combobox when the user selects their name.
I tried putting this in the Default Value:
But that didn't work.
I also tried:
But that didn't work either.
Does anybody have any suggestions?
TIA
~RLG
I have 3 tables:
User
ID FirstName LastName
Program
ID ProgramName
ProgramUserXRef
ID UserID ProgID
My form consists of an unbound ComboBox whose Row Source is the User table. I added an Option group that displays the Programs. I want the default for this group to come from the combobox when the user selects their name.
I tried putting this in the Default Value:
Code:
(SELECT DISTINCT ProgramUserXref .ProgramID FROM ProgramUserXref WHERE ((ProgramUserXref .UserID) = lUserID))
I also tried:
Code:
Private Sub cmbUser_AfterUpdate()
lUserID = Me.cmbUser
optProgramID.Requery
If Not IsNull(lUserID) Then
Dim MySQL As String
MySQL = "SELECT DISTINCT ProgramID FROM ProgramUserXref "
MySQL = MySQL & "WHERE UserID = lUserID"
Me!ProgID.DefaultValue = MySQL
Me!ProgID.Requery
End If
End Sub
Does anybody have any suggestions?
TIA
~RLG