Are this the correct coding for if else statement for the input box?
Can help me? - Dim Search As String, Message As String
-
Search = "Find RF"
-
Message = InputBox(Prompt, "Search")
-
If Message <> RF_NO Then
-
MsgBox "Data not exist"
-
Else
-
DoCmd.OpenForm "Product_Requisition", acNormal, , "[RF_no] Like '" & Message & "*'"
-
MsgBox "Data exist"
-
End If
5 1161
mrijet,
It is unclear from your code what "RF_NO" is. It seems to be listed as a variable, but it is neither declared nor set anywhere to say what it is.
If it is a control on a Form, then your code will only check to see if the input value matches what is currently displayed on your form, but will not "find" any record for you.
All that aside, if you were to delete lines 4-6 and line 9, the command to open a form "should" work, assuming all field names are correct.
Actually I choose to make a condition such as if I put the RF_no, they will find me the RF_no that exist for me..and if the RF_no did not exist it will show message box to me that show the data not exist...
So, did the coding I sent it was correct or not...or maybe you can help me? mrtwinnyfo
Again,
You have to help us out here. Your code provided does not tell us anything about what is going on. Is the Form Bound? We still don't know if RF_No is a variable or a control on a form or an underlying field in a table (we assume from one of your other posts that it is a field name).
However, without this information, it is difficult to guide to a solution. Standing by to assist as necessary.....
- Dim lngID As String
-
-
lngID = InputBox("Enter RF No")
-
If lngID = "" Then
-
DoCmd.ClearMacroError
-
Else
-
DoCmd.OpenReport "Requisition_ReportComplete", acViewReport, , "[RF_no]=" & lngID
-
End If
As you see the code above is for searching specific data and it's actually can work without any error..
But if I add this coding.... - Dim lngID As String
-
-
lngID = InputBox("Enter RF No")
-
If lngID = "" Then
-
DoCmd.ClearMacroError
- ElseIf lngID <> RF_no Then
-
MsgBox "Data not exist"
-
Else
-
DoCmd.OpenReport "Requisition_ReportComplete", acViewReport, , "[RF_no]=" & lngID
-
End If
And put none exist data it will not go the coding that I bold it...
Can help me?
mr twinnyfo
Please answer the questions of Post #4 and I can guide you toward a solution.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dgrabuloff |
last post by:
i am inputting records using a form. how do i put a command button on the form that will copy the record i just input----sometimes i have the same record that needs to be put in 3 or 4 times and i...
|
by: Steven |
last post by:
Hi,
Would need some thought about using a button of the existing form to search
record before deleting it.
Any quick help is very appreciated.
Steve
|
by: sirimanna |
last post by:
hi,
Is any one can help me to open files in my computer(for an example: some word document)using command button... i want to open file's using my vb programme..but i can't do it...can any one...
|
by: tejavenkat |
last post by:
Hi,
I have one scenario i.e Download as csv is there it is a command button when we click on this the save dialog box should be open,Am using javascript how can we do this by using by javascrpt...
|
by: beacon |
last post by:
Hi everybody,
I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button...
|
by: Palaniappan |
last post by:
how to add an item into the textbox by using command button in ms access in the form from the table?
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |