473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Please help me in correcting the code

Dear Friends,

kindly help me in correcting the following code

This code is for printing the report from the combo box after selection which connects to different reports as selected. I have written this code behind the combo box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Bank_Name_AfterUpdate()
  2.  
  3. Dim rpt As String
  4.  
  5. rpt = Bank_Name.AfterUpdate()
  6.  
  7. If rpt = "Andhra Bank" Then
  8.    DoCmd.OpenReport "Cheque Printing - Andhra Bank", acPreview
  9.  
  10. ElseIf rpt = "Canara Bank" Then
  11.        DoCmd.OpenReport "Cheque Printing - Canara Bank", acPreview
  12.  
  13. ElseIf rpt = "Central Bank of India" Then
  14.        DoCmd.OpenReport "Cheque Printing - Central Bank of India", acPreview
  15.  
  16. ElseIf rpt = "IDBI Bank" Then
  17.        DoCmd.OpenReport "Cheque Printing - IDBI Bank", acPreview
  18.  
  19. ElseIf rpt = "Indian Overseas Bank" Then
  20.        DoCmd.OpenReport "Cheque Printing - Indian Overseas Bank", acPreview
  21.  
  22. ElseIf rpt = "Indusind Bank" Then
  23.        DoCmd.OpenReport "Cheque Printing - Indusind Bank", acPreview
  24.  
  25. ElseIf rpt = "Ing Vysya Bank" Then
  26.        DoCmd.OpenReport "Cheque Printing - Ing Vysya Bank", acPreview
  27.  
  28. ElseIf rpt = "Union Bank of India" Then
  29.        DoCmd.OpenReport "Cheque Printing - Union Bank of India", acPreview
  30.  
  31. End If
  32.  
  33. End Sub
Please help me in correcting the code and i want whenvever they select the bank name it should go to the report which is created agains that bank.

Help requried urgencly.

Thanks & Regards,

Srinivas
Apr 6 '07 #1
1 1673
Rabbit
12,516 Expert Mod 8TB
Dear Friends,

kindly help me in correcting the following code

This code is for printing the report from the combo box after selection which connects to different reports as selected. I have written this code behind the combo box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Bank_Name_AfterUpdate()
  2.  
  3. Dim rpt As String
  4.  
  5. rpt = Bank_Name.AfterUpdate()
  6.  
  7. If rpt = "Andhra Bank" Then
  8.    DoCmd.OpenReport "Cheque Printing - Andhra Bank", acPreview
  9.  
  10. ElseIf rpt = "Canara Bank" Then
  11.        DoCmd.OpenReport "Cheque Printing - Canara Bank", acPreview
  12.  
  13. ElseIf rpt = "Central Bank of India" Then
  14.        DoCmd.OpenReport "Cheque Printing - Central Bank of India", acPreview
  15.  
  16. ElseIf rpt = "IDBI Bank" Then
  17.        DoCmd.OpenReport "Cheque Printing - IDBI Bank", acPreview
  18.  
  19. ElseIf rpt = "Indian Overseas Bank" Then
  20.        DoCmd.OpenReport "Cheque Printing - Indian Overseas Bank", acPreview
  21.  
  22. ElseIf rpt = "Indusind Bank" Then
  23.        DoCmd.OpenReport "Cheque Printing - Indusind Bank", acPreview
  24.  
  25. ElseIf rpt = "Ing Vysya Bank" Then
  26.        DoCmd.OpenReport "Cheque Printing - Ing Vysya Bank", acPreview
  27.  
  28. ElseIf rpt = "Union Bank of India" Then
  29.        DoCmd.OpenReport "Cheque Printing - Union Bank of India", acPreview
  30.  
  31. End If
  32.  
  33. End Sub
Please help me in correcting the code and i want whenvever they select the bank name it should go to the report which is created agains that bank.

Help requried urgencly.

Thanks & Regards,

Srinivas
rpt = Bank_Name.AfterUpdate()

That's the problem. You're setting rpt to either [Event Procedure] or the return value of the sub which should create some sort of infinite loop.

What you want to set it to is the value entered in Bank_Name which would be:
rpt = Me.Bank_Name
Apr 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: James Walker | last post by:
Can some one help I get an error of 'checkIndate' is null or not an object can someone please help. I can't work out why Thanks in advance James <form> <td height="24" colspan="7"...
6
by: gsb | last post by:
Don't know if this is the right place to post this JavaScript issue. If not, could someone point me in the right direction please. I am trying to make a "cross browser compliant" floating...
5
by: Dave Anderson | last post by:
I've done a bunch of googling and searched all the references I've got without finding anything that seems relevant to this issue; I'd appreciate any useful pointers or constructive comments. ...
7
by: Emmet Caulfield | last post by:
In the course of examining the code for an Internet-connected authentication server, I came across the following code (twice in one function with different constants in the "if") in a file of some...
25
by: nichas | last post by:
what does this part of the code mean.. iam not getting it.. ............ typedef int RowArray; RowArray *rptr; ............... i didnt get this.. please reply fast...thank you.
2
by: | last post by:
Help! I'm new to c++, and am breaking my teeth on MS Visual C++ (bundled within Visual Studio .NET 2003). Am trying to link simple c++ code to fortran dlls created in Compaq Visual Fortran (v6.1)....
10
by: Frank | last post by:
I've done this a few times. In a solution I have a project, Say P1, and need another project that will contain much code that is similar to that of P1. I hope no one gets hung up on why I...
6
by: JamesG | last post by:
I'm trying to convert a unix timestamp to a readable time, such as 4 hours ago, or 25 minutes ago. My code is below: function ago($ts) { /* time difference */ $ts = (time() - $ts); if($ts <...
12
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.