cigarprofiler
Registered User.
- Local time
- Yesterday, 16:26
- Joined
- Mar 25, 2017
- Messages
- 32
Absolute VBA noob here. I've been searching the net for days but the answers confuse me more than they help. I need a good VBA book...
Anyways, I have a search form based on a query that is based on tbl_models. When the model is found, you double-click on it in a listbox and a data entry form opens for that model. Works just fine, [modelid] is the primary key of tbl_models:
Instead of opening the data entry form frm_view_cigar, I want to open another form, called frm_review_cigar. This is a data entry form too, but based on another table, tbl_reviews. This table also contains the [modelid] field, but as a foreign key.
So I figured I'd do this:
Alas, no joy. The form opens all right, but the value for [reviewmodelid] is not passed on. What am I doing wrong? Please tell me it's just a minor syntax thing...
Also, book recommendations are appreciated
====================
BTW, I originally started out the second form frm_review with a combobox and that works fine. The selected [modelid] of the cigar is neatly entered into the [reviewmodelid] field.
My reason for wanting to use the other form is that with a combo, you can only search alphabetically, but the user may only know part of the name. Compare it to searching for "Mustang" while the combo wants you to start with "Ford".
On the other form, the user can type any part of the name through a nifty "like" statement in the query, which I poached off the internet.
I can use any text to populate the listbox (using some "like"-syntax in the query, which I poached off the internet), and in a combo you need to know the start of the name of the cigar you're looking for.
Anyways, I have a search form based on a query that is based on tbl_models. When the model is found, you double-click on it in a listbox and a data entry form opens for that model. Works just fine, [modelid] is the primary key of tbl_models:
Code:
DoCmd.OpenForm "frm_view_cigar", , , "[modelid] =" & Me.lstbx_search_results.Column(0)
Instead of opening the data entry form frm_view_cigar, I want to open another form, called frm_review_cigar. This is a data entry form too, but based on another table, tbl_reviews. This table also contains the [modelid] field, but as a foreign key.
So I figured I'd do this:
Code:
DoCmd.OpenForm "[B]frm_review[/B]", , , "frm_review.[[B]reviewmodelid[/B]] =" & Me.lstbx_search_results.Column(0)
Alas, no joy. The form opens all right, but the value for [reviewmodelid] is not passed on. What am I doing wrong? Please tell me it's just a minor syntax thing...
Also, book recommendations are appreciated
====================
BTW, I originally started out the second form frm_review with a combobox and that works fine. The selected [modelid] of the cigar is neatly entered into the [reviewmodelid] field.
My reason for wanting to use the other form is that with a combo, you can only search alphabetically, but the user may only know part of the name. Compare it to searching for "Mustang" while the combo wants you to start with "Ford".
On the other form, the user can type any part of the name through a nifty "like" statement in the query, which I poached off the internet.
I can use any text to populate the listbox (using some "like"-syntax in the query, which I poached off the internet), and in a combo you need to know the start of the name of the cigar you're looking for.