A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo Box to look up autonumber field in a form



 
 
Thread Tools Display Modes
  #1  
Old April 2nd, 2010, 09:29 PM posted to microsoft.public.access.forms
Chuck W[_2_]
external usenet poster
 
Posts: 98
Default Combo Box to look up autonumber field in a form

I have a form called frmFallVariancePastEntries that has field called FallID.
This is an autonumber field which is visible but not updatable. I have
thousands of records available and want to create a lookup combo box. I
created one called cblFindFallID. It is based on a query which lists all
FallIDs. I want to be able to go directly to the specific record based on the
Fall ID but am getting an error which says “Run Time Error 3464 Data Type
Mismatch in Criteria Expression”. Below is the vba code for this object. I
am doing the same thing in another database that I use but the field in that
database is not an autonumber field. Can someone help me modify this code to
look up this automnumber field?

Private Sub cboFindFallID_AfterUpdate()
Dim rst As Object
Set rst = Me.Recordset.Clone
rst.FindFirst "FallID = """ & cboFindFallID & """"
Me.Bookmark = rst.Bookmark
End Sub

  #2  
Old April 2nd, 2010, 09:38 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Combo Box to look up autonumber field in a form

Chuck

Warning! JOPO - Just one person's opinion ...

The folks who use my apps are very unforgiving about making them
remember/use IDs. They'd much rather be looking up a person's name, or a
part description, or a ...

Is there a chance your combobox could store (but hide) the FallID, and give
the users something they could relate to/understand better?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"Chuck W" wrote in message
...
I have a form called frmFallVariancePastEntries that has field called
FallID.
This is an autonumber field which is visible but not updatable. I have
thousands of records available and want to create a lookup combo box. I
created one called cblFindFallID. It is based on a query which lists all
FallIDs. I want to be able to go directly to the specific record based on
the
Fall ID but am getting an error which says "Run Time Error 3464 Data Type
Mismatch in Criteria Expression". Below is the vba code for this object.
I
am doing the same thing in another database that I use but the field in
that
database is not an autonumber field. Can someone help me modify this code
to
look up this automnumber field?

Private Sub cboFindFallID_AfterUpdate()
Dim rst As Object
Set rst = Me.Recordset.Clone
rst.FindFirst "FallID = """ & cboFindFallID & """"
Me.Bookmark = rst.Bookmark
End Sub



  #3  
Old April 2nd, 2010, 10:04 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Combo Box to look up autonumber field in a form

Chuck,
If you are after a autonumber field (numerical data) you should lose the
apostrophs. Try this:

Private Sub cboFindFallID_AfterUpdate()
Dim rst As Object
Set rst = Me.Recordset.Clone
rst.FindFirst "FallID = " & cboFindFallID
Me.Bookmark = rst.Bookmark
End Sub


if the finvalue you are after is a string then you should use apostrophs en
not only double quotes.

hth
--
Maurice Ausum


"Chuck W" wrote:

I have a form called frmFallVariancePastEntries that has field called FallID.
This is an autonumber field which is visible but not updatable. I have
thousands of records available and want to create a lookup combo box. I
created one called cblFindFallID. It is based on a query which lists all
FallIDs. I want to be able to go directly to the specific record based on the
Fall ID but am getting an error which says “Run Time Error 3464 Data Type
Mismatch in Criteria Expression”. Below is the vba code for this object. I
am doing the same thing in another database that I use but the field in that
database is not an autonumber field. Can someone help me modify this code to
look up this automnumber field?

Private Sub cboFindFallID_AfterUpdate()
Dim rst As Object
Set rst = Me.Recordset.Clone
rst.FindFirst "FallID = """ & cboFindFallID & """"
Me.Bookmark = rst.Bookmark
End Sub

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.