Adding the value of a combobox to a hidden column when a user enters a new record

RGoberto

New member
Local time
Today, 01:41
Joined
Aug 14, 2013
Messages
2
I'm very new to access so I'm not sure about the correct way to go about this. I have a table with a 'category' column, a form which hides the category column, and a combobox to filter the category, let's say R, C, and F.

What I want accomplish is to have the value of the comobox applied to the hidden 'category' column when a user enters a new record into the form.

Is there I way I can get an instance to the record as it's being entered and modify the data using VB? Or would I have to write a sort of pop() function and have it run afterInsert and then modify it that way? Can I even alter the table using VB like this?

Thank you
 
I assume you mean hidden field instead of column
One possible solution is to assign the value in the combo-box to a variable (ensures combo-box value doesn't change. Can be done using the syntax "variable = combobox.value"

Then you can insert the value using the variable into your record either using a record source or a sql statement. If the record exists, use the edit method for record source or an UPDATE statement for sql. If the record is new the use new method or an INSERT INTO statement for SQL.

Hope this is clear
TC
 
...or to bound your combo directly to that field. No more code, SQL or other Mandarin's words :)

Welcome to the forum !
 
...or to bound your combo directly to that field. No more code, SQL or other Mandarin's words :)

Welcome to the forum !


What I did was set the default value of the category field in properties to

=Left([Forms]![Formname]![Combo12],1)
[only need the first letter]
Which seems to have worked. Is this what you meant? If not, is there any documentation you could point me towards?
 
What I want accomplish is to have the value of the comobox applied to the hidden 'category' column when a user enters a new record into the form.
My mistake. Sorry. I've misunderstand your request.

Use the Click event for your combo
In this event:
Me.HiddenControlName.DefaultValue = Left(Me.Combo12,1)
 

Users who are viewing this thread

Back
Top Bottom