Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need code that does the same as hitting the F5 key

Posted on 2008-10-01
7
Medium Priority
?
482 Views
Last Modified: 2013-11-28
Could someone give me what the code should be to do the same thing as hitting F5 and the event to put it in.  I have two text boxes on my form. The first one I choose what FY I want, the next drop down should limit my choices based on the FY I choose but it doesn't unless I hit F5.

Thanks, Pat
0
Comment
Question by:PatKung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22616809
do you mean you have two combo boxes and you want to filter the second based on the selection from the first combo..

set the row source of the combo in the after update event of the the first combo

private sub combo1_afterupdate()

me.combo2.rowsource="select fieldName from tablex where [FY]= " & me.combo1

end sub

if [FY] is text data type use this

me.combo2.rowsource="select fieldName from tablex where [FY]= '" & me.combo1 &"'"
0
 

Author Comment

by:PatKung
ID: 22617027
That didn't work.  
Here is what I had on the Row Source for the second Combo:
SELECT DISTINCT tbl_05_TypeInvoice.strTypeInv FROM tbl_05_TypeInvoice INNER JOIN tbl_01_Main ON tbl_05_TypeInvoice.strTypeInv=tbl_01_Main.strTypeInv WHERE (((tbl_01_Main.intFY)=Forms!frm_05_InvoiceGen!txtChooseFY)) ORDER BY tbl_05_TypeInvoice.strTypeInv;

I removed it and put on the first Combo in the afterupdate:
Private Sub txtChooseFY_AfterUpdate()
Me.txtTypeInv.RowSource = "select intFY from tbl_01_Main where [intFY]= " & Me.txtChooseFY
End Sub

Chose 2007 on the first Combo, the second one gave me a string of 2007.  What I should have gotten was the five different types of invoices that exist with a FY of 2007.

Did I do something different than you said?

Thanks, Pat
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 2000 total points
ID: 22617156

try this

Private Sub txtChooseFY_AfterUpdate()
dim sql
sql="SELECT DISTINCT tbl_05_TypeInvoice.strTypeInv"
sql=sql & " FROM tbl_05_TypeInvoice INNER JOIN tbl_01_Main"
sql=sql & " ON tbl_05_TypeInvoice.strTypeInv=tbl_01_Main.strTypeInv"
sql=sql & " WHERE tbl_01_Main.intFY=" & me.txtChooseFY & "
sql=sql & " ORDER BY tbl_05_TypeInvoice.strTypeInv"

Me.txtTypeInv.RowSource = sql
End Sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:PatKung
ID: 22617216
That worked, but is there any code that just does what the F5 does that I could use when needed?  
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 22617256
try

Me.txtTypeInv.requery
0
 

Author Comment

by:PatKung
ID: 22617307
That worked perfect!  And a lot less code.  Still did it on the AfterUpdate of the previous ComboBox.  

Thanks, Pat
0
 

Author Closing Comment

by:PatKung
ID: 31502063
Thanks again!!
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question