JZeig1
JZeig1

Reputation: 423

Setting Form(subForm) recordsource equal to ComboBox

Having problem setting recordsource for form (and subform) to combobox(0) 'value'.

I have a statement that determine if the openArgs is from another form. If not, I want to able to set use the combobox in main to change the current record. Obviously, if don't do anything it with default to '0' as openArgs.

Private Sub cmbMemNam_AfterUpdate()
    Dim strMemNam As String
    strMemNam = "SELECT tblMembers.*, tblMembers.[mbr_ID] FROM tblMembers WHERE ((tblMembers.[mbr_ID]) = '" & (Nz(Me.cmbMemNam.Column(0)) & "')"
    Me.RecordSource = strMemNam
End Sub

I'm getting a compile error. I'm trying to locate a site that list the proper order of syntax for objects and SQL statements. I guess it just take practice.

Before the guru's jump on me...

Upvotes: 0

Views: 56

Answers (1)

Lee Mac
Lee Mac

Reputation: 16025

You have unbalanced parentheses surrounding your Nz expression:

( Nz ( Me.cmbMemNam.Column(0) )

Should be:

Nz(Me.cmbMemNam.Column(0))

Upvotes: 1

Related Questions