DefaultValue on a Query

G

Guest

Hi everyone
I'm a beginner in MS Access
Here's my doubt
A user working on a Form(FORM1) have one Listbox to choose the Operation (List1) and another lisbox to choose the Product (List2)
I've a table (TBL_TIME) and it has 4 Fields (Nr, Operation, Product, Time) on which will be recorded the data
Then my Query (QRY1) working on SQL will select only the fields (Operation, Product and Time)
The user would input values ONLY in column Time.
Now I'ld like to work with DefaultValue!
How can the Query output DefaultValues on the fields Operation and Product, because this values are allways the same
This Values come from List1 (List1.value) and List2(List2.value

How can I do this?

Please Help me
Thank you

Filipe Tabord
 
M

Michel Walsh

Hi,


A default value is used only at the moment where the record is created.
When you change the value of one of the combo box, the record is already
created, so, a default value won't modify the actual record. That being
said, you can change the default value, in the after update event of the
combo box, with a statement like:

Me.ControlNameForOperation.DefaultValue = """" & Me.ComboBox1
& """"


You can also add:

If IsNull( Me.ControlNameForOperation.Value ) Then
Me.ControlNameForOperation.Value = Me.ComboBox1
End If



Hoping it may help,
Vanderghast, Access MVP


Filipe Taborda said:
Hi everyone!
I'm a beginner in MS Access.
Here's my doubt:
A user working on a Form(FORM1) have one Listbox to choose the Operation
(List1) and another lisbox to choose the Product (List2).
I've a table (TBL_TIME) and it has 4 Fields (Nr, Operation, Product, Time)
on which will be recorded the data.
Then my Query (QRY1) working on SQL will select only the fields (Operation, Product and Time).
The user would input values ONLY in column Time.
Now I'ld like to work with DefaultValue!!
How can the Query output DefaultValues on the fields Operation and
Product, because this values are allways the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top