SQL to up date a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok form has 1 bound combo box and 1 listbox the unbound listbox updates the
regoin fine by using the following:
Private Sub Select_region_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE REGION = " &
Select_region.Value
End Sub

So on the bound combo box i thought i would use:
Private Sub Select_COMPANY_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE COMPANY NAME = " &
Select_COMPANY.Value
End Sub

This returns error Run-Time error'3075'
Syntax error (missing operator) in query expression 'COMPANY NAME= well this
is actually the correct value of select_company.value


What am i missing here
David
Michigan
 
Try this
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE [COMPANY NAME] = " &
Select_COMPANY.Value

your field has to name, you need to define them as one field, other wise the
query looks for operator between COMPANY and NAME
 
Well now it just changed to [COMPANY NAME] same error

Ofer said:
Try this
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE [COMPANY NAME] = " &
Select_COMPANY.Value

your field has to name, you need to define them as one field, other wise the
query looks for operator between COMPANY and NAME

David Michigan said:
Ok form has 1 bound combo box and 1 listbox the unbound listbox updates the
regoin fine by using the following:
Private Sub Select_region_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE REGION = " &
Select_region.Value
End Sub

So on the bound combo box i thought i would use:
Private Sub Select_COMPANY_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE COMPANY NAME = " &
Select_COMPANY.Value
End Sub

This returns error Run-Time error'3075'
Syntax error (missing operator) in query expression 'COMPANY NAME= well this
is actually the correct value of select_company.value


What am i missing here
David
Michigan
 
I don't that will be the answer for the error, but if the compant name field
is string then it should be

Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE [COMPANY NAME] = '" &
Select_COMPANY.Value & "'"

I would check the name of the fields again, but I assume you did that already

David Michigan said:
Well now it just changed to [COMPANY NAME] same error

Ofer said:
Try this
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE [COMPANY NAME] = " &
Select_COMPANY.Value

your field has to name, you need to define them as one field, other wise the
query looks for operator between COMPANY and NAME

David Michigan said:
Ok form has 1 bound combo box and 1 listbox the unbound listbox updates the
regoin fine by using the following:
Private Sub Select_region_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE REGION = " &
Select_region.Value
End Sub

So on the bound combo box i thought i would use:
Private Sub Select_COMPANY_AfterUpdate()
Form.RecordSource = "SELECT * FROM [WCC Dealers] WHERE COMPANY NAME = " &
Select_COMPANY.Value
End Sub

This returns error Run-Time error'3075'
Syntax error (missing operator) in query expression 'COMPANY NAME= well this
is actually the correct value of select_company.value


What am i missing here
David
Michigan
 
Back
Top