SQL and Using Text and Combo Boxes

SQL and Using Text and Combo Boxes

I write a statement such as

frmStatistics.datStatistics.RecordSource = "SELECT * FROM tblSpecialGroup Where Sex = 'M' AND Date BETWEEN '" & "051099" & "'" & " And " & "'" & "051499" & "'". 

This statement draws up records from my database that are Male and between the dates of 5-10-99 and 5-14-99 on an MSFlexGrid. Well, I want to enter the data from text boxes and combo boxes instead of putting the data in the code. Such as this statement:

frmStatistics.datStatistics.RecordSource = "SELECT * FROM tblSpecialGroup Where Sex = '" & Trim(cboDate(1).Text) & "'"

Well, both statements work, but what I’m having trouble with is making a statement that has a combo box for Sex and 2 text boxes for Date (so that the user can enter from 5-2-99 to 9-3-99 and so on). How do I make the statement to work with the SQL with the text boxes for date and combo box for sex? Here is my attempt (I have made many, but none of them work):

frmStatistics.datStatistics.RecordSource = "SELECT * FROM tblSpecialGroup Where Date BETWEEN '" & trim(txtdate1.Text) & "'" & " And " & "'" & trim(txtdate3.Text)& "'" & "'" AND Sex = '" & trim(cbogender.text) & "'"

Genie [email protected]

It seems to me that what is needed is a query parameter selection form part of this application; a place where the user enters in the things they are going to search for, then get them and process it.Is the datatype for sex also character or is it something like 1= male and 2 = female?

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes