sql statements in an event procedure

G

Guest

I am trying to do an SQL statement in a module. It is
highlighted in red.
I want to control the data in a combo box according to start and end dates
from a calendar.

Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
select * from RONCHECK_access where RONCHECK_access!DATE Between
[start_date_cal.value] And [end_date_cal.value];
 
R

Ron Weiner

I am not sure I understand what you are trying to do but Try:

strSql = "select * from RONCHECK_access " _
& "where RONCHECK_access.DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"

YourCombo.RowSource = strSql

Ron W
 
G

Guest

Thanks Ron. This is almost working. I am trying to get all the records
between a start date and an end date. I put strSQL in the RowSource but the
compiler gave me an error in the code & didn't know what to do about strSQL.
Can you give me another tip?

Ron Weiner said:
I am not sure I understand what you are trying to do but Try:

strSql = "select * from RONCHECK_access " _
& "where RONCHECK_access.DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"

YourCombo.RowSource = strSql

Ron W

lendapilot said:
I am trying to do an SQL statement in a module. It is
highlighted in red.
I want to control the data in a combo box according to start and end dates
from a calendar.

Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
select * from RONCHECK_access where RONCHECK_access!DATE Between
[start_date_cal.value] And [end_date_cal.value];
 
G

Guest

Ron, the compile error I got was "can't find project or library". Thanks.

Ron Weiner said:
I am not sure I understand what you are trying to do but Try:

strSql = "select * from RONCHECK_access " _
& "where RONCHECK_access.DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"

YourCombo.RowSource = strSql

Ron W

lendapilot said:
I am trying to do an SQL statement in a module. It is
highlighted in red.
I want to control the data in a combo box according to start and end dates
from a calendar.

Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
select * from RONCHECK_access where RONCHECK_access!DATE Between
[start_date_cal.value] And [end_date_cal.value];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top