|
|
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
|
|
0
|
|
|
|
Reply
|
Utf
|
4/2/2010 8:29:01 PM |
|
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" <ChuckW@discussions.microsoft.com> wrote in message
news:60E5B9B6-B83B-48EC-A981-55E6E1B1C58E@microsoft.com...
>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
>
|
|
0
|
|
|
|
Reply
|
Jeff
|
4/2/2010 8:38:33 PM
|
|
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
>
|
|
0
|
|
|
|
Reply
|
Utf
|
4/2/2010 9:04:01 PM
|
|
|
2 Replies
200 Views
(page loaded in 0.203 seconds)
Similiar Articles: Have combo box fill several fields on form - microsoft.public ...... three fields on the same form. I have the form and combo box constructed, and can see ... the fields on ... Using Combo Box to Auto Fill Data DataBase I have a form set up ... Access combo box control by another data field - microsoft.public ...Hi, I use a combo box in a form with look-up from a table for selecting data. ... data in the table, depending on a value in another field in the form. I the combo box ... Combo Box to look-up values from another form - microsoft.public ...Access combo box control by another data field - microsoft.public ... Hi, I use a combo box in a form with look-up ... want to only see a selection of the data in the ... Combo Box to select a record and populate fields in a form ...... fields on the form. On the combo box, I ... pull up the rest of the fields from the same record as the BoxNo that is selected in the combo box. ... look at the combo box and ... Using a combo box to determine which field to search. - microsoft ...I want to have a search form that has two fields, one a combo box ... box control by another data field - microsoft.public ... Hi, I use a combo box in a form with look-up ... Call form from text field and populate combo box. - microsoft ...Form 1 contains a combo box ... form based on Combo box choice General ... I have one table that has 4 fields, ID (autonumber ... up to nine different fields in a combo box Populate a text box based on a combo box - microsoft.public.access ...... see for needing a text box is if the second combo box is if the Grocery Type field in the form ... autonumber, and the corresponding foreign key field in the form's underlying table, i.e. the field to which the second combo box ... Formatting a Combo box - microsoft.public.access.forms... formating i've tried does anything to >>the combo box. This field is used to look up a ... auto number) and txtSSN, txtLName, etc. fields. I have a form with a combo box used ... auto populate text box based on combo box value - microsoft.public ...... the combo box: Rep field = combo box ... populate form fields based on combo box ... form from ... where clause from a combo box value. ... last name and then you want to look up ... Save values displayed in unbound text fields from combo box to tab ...... see my mistakes? - Here is the code I have for my form ... combo box into a field on your form ... up a text box to display a date value when another field has a ... combo ... Combo Box - Access wiki - Access Help and How-to - Microsoft ...A Combo Box is a Form Control which has a list of items ... People table, define a PersonID AutoNumber field ... view and the user will only see the values while the Combo Box will ... Bind combo box to primary key but display a description field ...My problem is one of the look up fields (combo box) needs to display ... displays customer contacts, CustomerID is autonumber and primary key The table the above form ... Combo box auto-populate other combo box(s) on same form ...Here are my Tables, and Form: tbladvertiser; PKID - AutoNumber ... enter 336x280 in AdtypeID combo box on the Form ... event of the Adtype combo to look up the ... combo boxes on form - Microsoft Answers... with the following fields: Category / sub-section / question / answer I want a form with a combo box for ... CatergoryID = AutoNumber. Category ... Enter the characters you see ... Create a list box, combo box, or drop-down list box - Access ...... the list box to look up ... Lookup field. Do one of the following: Create a new form with a list box or combo box ... box or combo box on a form so that the query doesn't show up ... 7/18/2012 3:53:27 AM
|
|
|
|
|
|
|
|
|