Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2003, 04:09 PM
Authorized User
 
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the code that is working at the moment, it is in the .AfterUpdate event

Private Sub Frame_InvUpd_Category_AfterUpdate()

Dim strCategory As String
   Select Case Me.Frame_InvUpd_Category.Value
      Case 1
         strCategory = "Long Range"
      Case 2
         strCategory = "Mid Range"
      Case 3
         strCategory = "Putt & Approach"
      Case 4
         strCategory = "Recreational"
      Case 5
         strCategory = "Specialty"
   End Select
   Me.Cmb_InvUpd_Prod.RowSource = "SELECT Product.Product_Name " & _
      "FROM Product WHERE (((Product.Product_Category) = '" & _
      strCategory & "')) ORDER BY Product.Product_Name;"
End Sub



Quote:
quote:If you need to have the combo box's rowsource updated for an existing record is displayed with a selected value for an option button, you can put the SQL build statements in a shared function within the form and call it from the AfterUpdate on the buttons and from the Form_Current(). Just be sure that the Form_Current() will only call the function if Me.NewRecord = False.
*Watches the words fly over his head* eh?
 
Old November 19th, 2003, 10:20 AM
Authorized User
 
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My main point that I was trying to make was utilizing the .Requery
method against the combo box. I did not see it mentioned in any of
the previous replies - this is one of the most common problems
that occurs when attempting to update the contents of a combo box's
rowsource. Unless this has been updated otherwise as newer versions
of MS-Access have been released, the Requery method was required
once a combo box's RowSource was updated if you want to change it
while the form was open on the same record. Sorry, I didn't take the
last comment too well, that's all.
 
Old November 19th, 2003, 10:55 AM
Authorized User
 
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't be sorry, I'm glad you clarified. I really wasn't sure what you meant.

I apologize for not being more VBA savvy...
 
Old November 19th, 2003, 02:04 PM
Authorized User
 
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're doing fine, Anubis. :)

Looks like I need to be just a little more careful when
trying to answer stuff when I'm in the middle of something
else.

It looks like we have an excellent community of people out
here with alot of great ideas. Makes me wish that I had the
web and forums like this when I started.

Keep on jammin!

Warren
 
Old November 19th, 2003, 02:29 PM
Authorized User
 
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm still struggling with the rest of the objects on my InvUpd form...
 
Old November 20th, 2003, 12:19 PM
Registered User
 
Join Date: Nov 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is just a Suggestion. Did you try the SQL query in the Queries first? Make sure the query you wrote works. Some times you assume that it's the problem with the code and it happens to be the query. Just a suggestion.
 
Old November 20th, 2003, 12:45 PM
Authorized User
 
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yeah, the queries work like a champ. I've actually moved on from this problem because it is working now.

unfortunately, this was one step in a rather complicated inventory update process. I'm going to post a link to a screen shot of my form and explain the logic behind it as best I can.

Perhaps someone can give me some pointers on form design or tell me I'm on the right track and help me with the code...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Check Boxes/Option buttons/Option Group hewstone999 Access VBA 1 March 14th, 2008 07:25 AM
Error is using option buttons return value Subuana Beginning VB 6 2 May 1st, 2006 03:39 PM
updating text fields with option buttons redtechcoms Access VBA 7 February 2nd, 2006 03:14 PM
Using Option buttons NovieProgrammer Access VBA 1 April 2nd, 2005 09:16 PM
Is one (1) a 'length' for option buttons? John K. King Javascript How-To 2 November 7th, 2004 06:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.