Combo Box Search (1 Viewer)

Emma35

Registered User.
Local time
Today, 09:17
Joined
Sep 18, 2012
Messages
467
Hi All,
Can anyone tell me why the combo box search on the form which loads on start up doesn't work. I have a similar one on another database which works perfectly.

Thanks
 

Attachments

  • Copy.zip
    138.8 KB · Views: 33

CJ_London

Super Moderator
Staff member
Local time
Today, 17:17
Joined
Feb 19, 2013
Messages
16,606
the error message you get is quite clear - what do you not understand about it?

You are trying to find a record which matches on fullname, but your recordsource does not contain such a field. Names are risky fields to match on when looking for a specific record - what if you have two employees with the same name (it happens)

change your find to match on employeeID instead
 

deletedT

Guest
Local time
Today, 17:17
Joined
Feb 2, 2019
Messages
1,218
It's what CJ_London is explaining.

Personally I prefer to show Employee ID in the search combo too. But for now it's hidden.
 

Attachments

  • Copy.zip
    142.6 KB · Views: 29

Emma35

Registered User.
Local time
Today, 09:17
Joined
Sep 18, 2012
Messages
467
Thanks for having a look. I realise the error is telling me something straight forward but i still can't fix it. I changed the combo box to search by EmployeeID but am getting the error message attached. The RowSource for the combo is now

SELECT [qry_FullNames].[EmployeeID], [qry_FullNames].[FullName] FROM qry_FullNames ORDER BY [FullName];
 

Attachments

  • Capture.PNG
    Capture.PNG
    21.6 KB · Views: 21

CJ_London

Super Moderator
Staff member
Local time
Today, 17:17
Joined
Feb 19, 2013
Messages
16,606
have you seen the fix returned by Tera?
 

Emma35

Registered User.
Local time
Today, 09:17
Joined
Sep 18, 2012
Messages
467
Yes i've read both posts. I have the combo showing both EmployeeID and Name now. The error says data type mismatch. I know there's no field in the table called FullName, which is why the combo is looking at a query. Is this error something to do with syntax in the rowsource code ?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:17
Joined
Feb 19, 2013
Messages
16,606
have you tried the example provided by Tera - it works for me
 

Emma35

Registered User.
Local time
Today, 09:17
Joined
Sep 18, 2012
Messages
467
Ah sorry i apologise....i actually didn't notice the attachment. Yes it works great but what was i doing wrong....just in case it happens again ?

Thank you Tera
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:17
Joined
Feb 19, 2013
Messages
16,606
compare the rowsource between your version and Tera's and also the code in the combo afterupdate event.

Also compare the bound column and column widths properties of the combo

the error you were getting was because you were trying to compare text with a number
 

Emma35

Registered User.
Local time
Today, 09:17
Joined
Sep 18, 2012
Messages
467
Ok i understand now. I'll make a note of that for the future.

Thanks for your help again.
 

Users who are viewing this thread

Top Bottom