H
Hilary Ostrov
I'm not a programmer, but I am a firm believer in well thought out
user-friendly, intuitive, logical interfaces! I've often used
customized Access apps. created by others - in which such principles
seemed conspicuous by their absence!
So now I'm dabbling my feet into the waters of developing my own! I
am not particularly knowledgeable about VBA coding, syntax, naming
conventions etc. (although I'm figuring out some as I go along! And if
someone could point me to a primer on the meanings and common usage of
<Me.> <Dim> and such, I would be eternally grateful!) But that aside
....
Using Access 2000 on a Win XP system, I have a Form for entering
product data. I've successfully created combo boxes and managed to
get the results of a selection to populate other fields - primarily by
finding snippets of code elsewhere, and modifying accordingly. To
save keystrokes, I've even set Tab Stop=No in those fields which will
not require user input!
I've also successfully coded fields to do simple calculations based on
the data entered in other fields. It all works like a charm!
But I know that I need something else to ensure that any subsequent
change in one or more of the fields of the record on which a
calculation has been based will be reflected in the result(s) field(s)
- without having to re-enter unchanged data any other fields included
in the calculation!
Re-entering all relevant fields does the trick, but I'm sure there
must be a simple piece of code to bypass the need for this.
The fields in question are as follows:
Unit [selected from combo box]
U Price [text box]
Prof [text box]
S Price [text box based on calcuation]
Qty [text box]
Pcd Price [text box based on calculation]
(yes, I know ... spaces in field names is not the best practice, but
the person who will be using this .mdb is accustomed to seeing them
this way!)
Here's my relevant code so far:
====
Private Sub Prof_AfterUpdate()
'Update the S Price Field'
Me.S_Price.Value = ((U_Price / Unit) * (100 + Prof) / 100)
End Sub
Private Sub Qty_AfterUpdate()
'Update the Purchased Price field'
Me.Pcd_Price.Value = (U_Price / Unit) * Qty
End Sub
Private Sub Unit_AfterUpdate()
'Update the Unit field'
Me.Unit.Value = Me.Unit.Column(1)
End Sub
====
What am I missing?!
Incidentally the Unit combo box Column count is 3 and Row source :
SELECT [tblMeasure].[Unit], [tblMeasure].
user-friendly, intuitive, logical interfaces! I've often used
customized Access apps. created by others - in which such principles
seemed conspicuous by their absence!
So now I'm dabbling my feet into the waters of developing my own! I
am not particularly knowledgeable about VBA coding, syntax, naming
conventions etc. (although I'm figuring out some as I go along! And if
someone could point me to a primer on the meanings and common usage of
<Me.> <Dim> and such, I would be eternally grateful!) But that aside
....
Using Access 2000 on a Win XP system, I have a Form for entering
product data. I've successfully created combo boxes and managed to
get the results of a selection to populate other fields - primarily by
finding snippets of code elsewhere, and modifying accordingly. To
save keystrokes, I've even set Tab Stop=No in those fields which will
not require user input!
I've also successfully coded fields to do simple calculations based on
the data entered in other fields. It all works like a charm!
But I know that I need something else to ensure that any subsequent
change in one or more of the fields of the record on which a
calculation has been based will be reflected in the result(s) field(s)
- without having to re-enter unchanged data any other fields included
in the calculation!
Re-entering all relevant fields does the trick, but I'm sure there
must be a simple piece of code to bypass the need for this.
The fields in question are as follows:
Unit [selected from combo box]
U Price [text box]
Prof [text box]
S Price [text box based on calcuation]
Qty [text box]
Pcd Price [text box based on calculation]
(yes, I know ... spaces in field names is not the best practice, but
the person who will be using this .mdb is accustomed to seeing them
this way!)
Here's my relevant code so far:
====
Private Sub Prof_AfterUpdate()
'Update the S Price Field'
Me.S_Price.Value = ((U_Price / Unit) * (100 + Prof) / 100)
End Sub
Private Sub Qty_AfterUpdate()
'Update the Purchased Price field'
Me.Pcd_Price.Value = (U_Price / Unit) * Qty
End Sub
Private Sub Unit_AfterUpdate()
'Update the Unit field'
Me.Unit.Value = Me.Unit.Column(1)
End Sub
====
What am I missing?!
Incidentally the Unit combo box Column count is 3 and Row source :
SELECT [tblMeasure].[Unit], [tblMeasure].
Code:
, [tblMeasure].[Note]
FROM tblMeasure;
It is currently bound to Column 1 and it works! But ideally, I'd like
the user to be able to do kbd alpha selection of Code (e.g. EA or C)
(rather than cycling through list with cursor key) and have this
"translate" (although I'm sure that is not the correct term!) into the
numerical Unit value (e.g. 1 or 100)
Again, I'm sure this must be doable, and I've tried a few ways, but
they don't give me the desired result! One thing I haven't tried is
including the ID in the tbl query. Could that be the key?!
Many thanks in advance!
hro