From: Sue Compelling on 1 Mar 2010 01:02 Hi (Access 2007) I have the following code which works perfectly well for me on one form, though when I've tried to replicate it on another form I get a run time error 3077 - Syntax error (missing operator) in expression .... I hope you can help (they look exactly the same to me!) TIA. WORKING CODE Private Sub SearchCombo_AfterUpdate() With Me.RecordsetClone .FindFirst "JobID = " & SearchCombo If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With Me.Notes.SetFocus End Sub NON - WORKING CODE Private Sub SearchCbo_AfterUpdate() With Me.RecordsetClone .FindFirst "NIRID = " & SearchCbo If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With Me.Customer.SetFocus End Sub -- Sue Compelling
From: Stuart McCall on 1 Mar 2010 02:59 "Sue Compelling" <SueCompelling(a)discussions.microsoft.com> wrote in message news:FA3D0F8A-399B-4F00-81B2-7B9C8EB77A5D(a)microsoft.com... > Hi (Access 2007) > > I have the following code which works perfectly well for me on one form, > though when I've tried to replicate it on another form I get a run time > error > 3077 - Syntax error (missing operator) in expression .... I hope you can > help > (they look exactly the same to me!) TIA. > > WORKING CODE > > Private Sub SearchCombo_AfterUpdate() > With Me.RecordsetClone > .FindFirst "JobID = " & SearchCombo > If Not .NoMatch Then > Me.Bookmark = .Bookmark > End If > End With > Me.Notes.SetFocus > End Sub > > > NON - WORKING CODE > > Private Sub SearchCbo_AfterUpdate() > With Me.RecordsetClone > .FindFirst "NIRID = " & SearchCbo > If Not .NoMatch Then > Me.Bookmark = .Bookmark > End If > End With > Me.Customer.SetFocus > End Sub > -- > Sue Compelling Well one thing jumps out straightaway. In the working version your combo is called SearchCombo, whereas in the non-working code, it's called SearchCbo. Perhaps you need to review your control names...
From: Linq Adams via AccessMonster.com on 1 Mar 2010 05:14 My guess would be that JobID is defined as a Number Datatype. NIRID is defined as a Text Datatype, in which case the correct syntax would be FindFirst "NIRID = '" & SearchCbo & "'" -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
From: Sue Compelling on 2 Mar 2010 04:35 Hi Linq It's definitely a number (NIRID is an AutoNumber). The two forms are actually in the same database and store different record types - hence the SearchCombo for one Form and the SerchCbo for the other form. Is that possibly what's making the difference? ps - when I run my cursor over the .FindFirst "NIRID = " & SearchCbo in the code it shows up the right data (ie - what's been selected in my SearchCbo) -- Sue Compelling "Linq Adams via AccessMonster.com" wrote: > My guess would be that JobID is defined as a Number Datatype. > > NIRID is defined as a Text Datatype, in which case the correct syntax would > be > > FindFirst "NIRID = '" & SearchCbo & "'" > > -- > There's ALWAYS more than one way to skin a cat! > > Answers/posts based on Access 2000/2003 > > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1 > > . >
|
Pages: 1 Prev: Mouse Move response based on combo box value Next: Export Report based on Filter |