May 4, 2009 at 11:13 am
I need to have my access form keep the previously entered data in a field for the next record. The field is a Combo-Box with a Value List as the Row Source. Any help would be very helpful.
Thanks
May 4, 2009 at 11:16 am
In your modules, create a module that can take the value as an input, a global variable that the module can assign the value to, and a function that can return the value. I got tremendous efficiency out of a system like that a few years ago. Was great for holding application state values that I could then use in multiple forms.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 4, 2009 at 11:35 am
I apologize but I'm a Novice and learning as I go. I appreciate any help you can provide.
May 6, 2009 at 11:08 am
I can't tell from your post whether you have a question on what I wrote, or whether you're just making a general statement.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 7, 2009 at 5:02 am
Good point - Unfortunately I don't know how to carry out your suggestion on what to do for my issue.
May 7, 2009 at 6:55 am
I don't have a copy of Access available right now, but from what I remember (I used to do a lot of this two years ago), what you do is go to the list of objects. It will have options like "tables", "views", "forms", and one called "modules".
Go to the modules one, and write something like this:
public intMyValue as Int
public function fMyValue
fMyValue = intMyValue
end function
public sub setMyValue (by value intMyVal as Int)
intMyValue = intMyVal
end sub
It's been a while since I wrote any VBA code, but I remember it being something like that. If you go into the Access help files, and look up public variables, public functions, public subs and Modules, it should have data on how to fix what I just wrote. (Unless, by some miracle, my memory is good enough to have written it correctly, which is highly doubtful.)
Once you have those working, you can use the function name in things like input parameters, event scripts for buttons, etc., and they can all get or assign values.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 7, 2009 at 7:23 am
Ok - thanks I'll work with this.
May 7, 2009 at 7:28 am
rayzor (5/4/2009)
I need to have my access form keep the previously entered data in a field for the next record. The field is a Combo-Box with a Value List as the Row Source. Any help would be very helpful.Thanks
You could add an After Update event that sets the default value to the current value.
In the combo box properties, in the Event tab double-click on "After Update" which then turns into [Event procedure] and click the 3 dots (...) and write your code which might look like this:
Private Sub MyComboBox_AfterUpdate()
Me.MyComboBox.DefaultValue = "='" & Me.MyComboBox & "' "
End Sub
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply