Hi, I'm working on an Access 2007 database. I'm trying to build a search form that opens up your search on a query. I was working before, but I feel like i change something and now, it doesn't give me what I'm asking for. I have three fields on the form (companycell, companyflux, companyribbon). I don't know how to incorporate the value from companycell to the field on the query. - Private Sub Findbtm_Click()
-
-
If Me.CompanyCell.Value = "" Then
-
Beep
-
Select Case MsgBox("Cell Company is required", vbOK)
-
Case vbOK: 'do nothing
-
Case Else: 'do nothing
-
End Select
-
Else
-
-
If [Companyflux] = [company name] Or [CompanyRibbon] = [Company] Or [Companyflux] = "" Or [CompanyRibbon] = "" Then
-
-
DoCmd.OpenQuery "Sales"
-
Else
-
Beep
-
Select Case MsgBox("Combination not found. Would you like possible combinations?", vbYesNo)
-
Case vbYes: 'finds possible combinations
-
Beep
-
Select Case MsgBox("Would you like to make Flux unknown?", vbYesNo)
-
Case vbYes: 'Makes flux company unknown
-
Me.Companyflux.Value = ""
-
Me.newflux = Me.Companyflux
-
Me.newcell = Me.CompanyCell
-
Case vbNo: 'leaves flux company as it is
-
Me.newflux = Me.Companyflux
-
Me.newcell = Me.CompanyCell
-
Case Else: 'default case to trap any errors
-
'do nothing
-
End Select
-
Beep
-
Select Case MsgBox("Would you like to make Ribbon unknown?", vbYesNo)
-
Case vbYes: 'makes ribbon company unknown
-
Me.CompanyRibbon.Value = ""
-
Me.newribbon = Me.CompanyRibbon
-
Me.newcell = Me.CompanyCell
-
Case vbNo: 'leaves ribbon company as it is
-
Me.newribbon = Me.CompanyRibbon
-
Me.newcell = Me.CompanyCell
-
Case Else: 'defaul case to trab any errors
-
'do nothing
-
End Select
-
If [newflux] = [company name] Or [newribbon] = [Company] Or [newflux] = "" Or [newribbon] = "" Then
-
-
DoCmd.OpenQuery "Sales", acViewNormal
-
-
Else
-
Beep
-
Select Case MsgBox("Combination not found. Would you like to add a New Product?", vbYesNo)
-
-
Case vbYes: 'opens new product "entry form" and closes "sales" form
-
DoCmd.OpenForm "entry form"
-
DoCmd.Close acForm, "sales"
-
-
Case vbNo: 'closes "sales" form and goes to "main menu"
-
DoCmd.OpenForm "main menu"
-
DoCmd.Close acForm, "sales"
-
-
End Select
-
-
End If
-
-
Case vbNo:
-
'Do nothing
-
-
Case Else: 'Default case to trap any errors
-
'Do nothing
-
-
End Select
-
-
-
End If
-
End If
-
End Sub
-
-
-
Any ideas? I'm knew at this and I'm getting frustrated because I can't find what is wrong with this.
Thanks before hand!
2 1688
ok, I changed the if statements. It works find for one field on the form, newflux. but it does not work for my second field, newribbon. Any ideas would be much appreciated, thank you. - Private Sub Findbtm_Click()
-
-
If Me.CompanyCell.Value = "" Then
-
Beep
-
Select Case MsgBox("Cell Company is required", vbOK)
-
Case vbOK: 'do nothing
-
Case Else: 'do nothing
-
End Select
-
Else
-
Me.cellbox = Me.CompanyCell
-
Me.newcell = Me.CompanyCell
-
Me.firstflux = Me.Companyflux
-
Me.firstribbon = Me.CompanyRibbon
-
If [firstflux] = [company name] Or [firstribbon] = [Company] Then
-
-
DoCmd.OpenQuery "Sales"
-
Else
-
Beep
-
Select Case MsgBox("Combination not found. Would you like possible combinations?", vbYesNo)
-
Case vbYes: 'finds possible combinations
-
Me.newcell = Me.CompanyCell
-
Beep
-
Select Case MsgBox("Would you like to make Flux unknown?", vbYesNo)
-
Case vbYes: 'Makes flux company unknown
-
Me.Companyflux.Value = ""
-
Me.newflux = Me.Companyflux
-
-
Case vbNo: 'leaves flux company as it is
-
Me.newflux = Me.Companyflux
-
-
Case Else: 'default case to trap any errors
-
'do nothing
-
End Select
-
Beep
-
Select Case MsgBox("Would you like to make Ribbon unknown?", vbYesNo)
-
Case vbYes: 'makes ribbon company unknown
-
Me.CompanyRibbon.Value = ""
-
Me.newribbon = Me.CompanyRibbon
-
-
Case vbNo: 'leaves ribbon company as it is
-
Me.newribbon = Me.CompanyRibbon
-
-
Case Else: 'defaul case to trab any errors
-
'do nothing
-
End Select
-
If [newflux] = "" Or [newribbon] = "" Then
-
-
DoCmd.OpenQuery "Sales", acViewNormal
-
-
ElseIf [newflux] = [company name] Or [newribbon] = [Company] Then
-
DoCmd.OpenQuery "Sales", acViewNormal
-
ElseIf [newflux] = "" Or [newribbon] = [Company] Then
-
DoCmd.OpenQuery "Sales", acViewNormal
-
ElseIf [newribbon] = "" Or [newflux] = [company name] Then
-
DoCmd.OpenQuery "Sales", acViewNormal
-
Else
-
Beep
-
Select Case MsgBox("Combination not found. Would you like to add a New Product?", vbYesNo)
-
-
Case vbYes: 'opens new product "entry form" and closes "sales" form
-
DoCmd.OpenForm "entry form"
-
DoCmd.Close acForm, "sales"
-
-
Case vbNo: 'closes "sales" form and goes to "main menu"
-
DoCmd.OpenForm "main menu"
-
DoCmd.Close acForm, "sales"
-
-
End Select
-
-
End If
-
-
-
-
Case vbNo:
-
'Do nothing
-
-
Case Else: 'Default case to trap any errors
-
'Do nothing
-
-
End Select
-
-
-
End If
-
End If
-
End Sub
-
code green 1,726
Recognized Expert Top Contributor
What do you mean by "but it does not work"?
How do you know "It works find for one field on the form, newflux"?
Also what does this mean
I don't know how to incorporate the value from companycell to the field on the query
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Greener |
last post by:
Hi, I need help badly. Can you do client-side programming instead of
server-side to capture the Browser type info? If this is the case,
what's wrong with the following?
<script...
|
by: WindAndWaves |
last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.
I can understand that it may lead to confusing code, but I often use it like
this:
is this...
|
by: Niklaus |
last post by:
Hi,
Can someone point out what is wrong with this code ? How can i make
it better optimize it. When run it gives me seg fault in linux. But
windows it works fine(runs for a long time).
Do we...
|
by: Matt |
last post by:
Hi,
I have a probelm here:
If I declare:
char *p="Hello";
|
by: Protoman |
last post by:
Could you tell me what's wrong with this program, it doesn't compile:
#include <iostream>
#include <cstdlib>
using namespace std;
class Everything
{
public:
static Everything* Instance()
| |
by: Pyenos |
last post by:
import cPickle, shelve
could someone tell me what things are wrong with my code?
class progress:
PROGRESS_TABLE_ACTIONS=
DEFAULT_PROGRESS_DATA_FILE="progress_data"
PROGRESS_OUTCOMES=
|
by: Bill Reid |
last post by:
#define MAX_VALUES 64
typedef struct {
unsigned value_1;
double value_2;
double value_3;
double value_4;
} VALUES;
typedef struct {
|
by: ccarter45 |
last post by:
I need to count the number of letters in a string, disregarding case. It needs to use these two methods. What's wrong?
import java.util.Scanner;
public class CountLetters
{
public static void...
|
by: hirsh.dan |
last post by:
i have a functions that writes information to a file.
inside that function i have a line in which i call another function.
if this line is executed, nothing is written to the file, but if i
remark...
|
by: mingke |
last post by:
Hi...
So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer....
So here's the part of my code I have problem with:
for (i=0; i<size2;...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |