Afiqah-
Using command buttons is a bad idea. As Bill pointed out earlier, that would force you to change your form design every time you added a new model. What you need is a combo box and a command button. The Row Source needs to look something like:
SELECT ID, ModelName FROM tblmodelspecification ORDER BY ModelName;
You will need to use the actual name of the field in tblModelspecification that has the model name - I just guessed at "ModelName".
Set the Bound Column to 1, Column Count to 2, and Column Widths to 0";1.5"
Name the combo box cboModel.
In the Click event of the command button, run your OpenForm action.
Where Condition: [ID] = [Forms]![frmHome]![cboModel]
You can open it in Read Only or Edit mode - your choice.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Mar 25, 2015, at 5:01 AM, afiqah afiq bubbleblue_007@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
hi John & Duanne!
let me reconstruct my question. :)
1) I have created a table tblmodelspecification, consist of 37 fields. ID is Primary field and the records stored are ( Ford Fiesta, Ford Focus, VW Polo and etc.)
2) Based on tblmodelspecification, I created a form frmmodelspecification that displays all 37 fields for one record only. By default, when I change it to form view, it will display the first record data which is Ford Fiesta.
3)I also created another form frmHome. This form is under unrelated object section. I have changed the label to button controls where I have number of buttons same as number of records. I named the button as Ford Fiesta, Ford Focus, VW Polo and etc.
4) The situation is I want the user to choose a button among buttons in frmHome. If the user click on Ford Fiesta button, the program will open frmmodelspecification and displays Ford Fiesta record.
5) my question is how to create events to fulfil the above situation?
I have tried to create an event for Ford Fiesta button. I used macro builder.
Action: OpenForm
From Name: frmmodelspecification
View: Form
Filter name:
Where Condition: [ID]=[Forms]![frmmodelspecification]![ID]
Data Mode: Edit
Window Mode: Normal
The result is when I set Data Mode to read only, the output is just a blank white screen and when I set Data Mode to Edit, the output is frmmodelspecifation form is open without any records appear. Images and labels are appeared in the form.
hmm..sorry, I'm truly a Ms Access beginner. Hope you can guide me.
Thank you!
Regards,
Afiqah
On Wednesday, March 25, 2015 3:30 AM, "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
My bad. Yes, stand-alone labels have a few events, including Click and Dbl Click.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Mar 24, 2015, at 8:22 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
__._,_.___
Posted by: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar