Board index » delphi » Field not found
P.S.Bell
![]() Delphi Developer |
Field not found2004-07-02 12:08:52 AM delphi39 I had a simple locate that worked. I then applied some code to force the window to the front as elegantly created by John Herbert in this NG. Applied as follows: fmCoreStart.ForceForegroundWindowOK (fmArchiveData.Handle); if not Temp.Locate('JobNo', archiveDM.Jobs.FieldByName('JobNo').Value, []) then begin Code for forceforegroundwindowOK is included below. It does indeed bring the window to the fore but it also breaks the locate, for some reason giving an error 'Jobs Field JobNo not found' but commenting out the call to fmCoreStart.ForceForegroundWindowOK renders it functional again. Debug tooltip shows that JobsJobNo does actually exist. fwiw the table has no fields defined at designtime. function TfmCoreStart.ForceForegroundWindowOK (h: HWND): boolean; var hCurWnd: THandle; begin hCurWnd := GetForegroundWindow; AttachThreadInput( GetWindowThreadProcessId(hCurWnd, nil), GetCurrentThreadId, True); Result := SetForegroundWindow(h); AttachThreadInput( GetWindowThreadProcessId(hCurWnd, nil), GetCurrentThreadId, False); end; Pat Bell |