By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 987 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

vb 6 vs excell

P: 2
Hello all,
I've got 2 questions.
First question
If somebody know how to use data range. Meant that there's a date for a month. And every single day have own record. So I only want to know date from 12-16 September and it will displayed at data grid.
FYI, I already using this command and there's an error display
runtime error, type mismatch

dbEnq.RecordSource = " select * from Enquirer where Date > '" & Format("MM/dd/yyyy", txtDate1.Text) & "'" And " Date < '" & Format("MM/dd/yyyy", txtDate2.Text) & "'"
dbEnq.Refresh

On the form, there's a button, 2 textboxes, 1 adodc connected to database, 1 datagrid.

Second question
From the datagrid that displays, I want to export it to Excel document as a report.

I hope someone has solved this problem before.
Sep 24 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
First question
Use hash (#) delimiters around the date values, not quotes (').

Second question
No idea. Sorry.
Sep 26 '07 #2

Expert 5K+
P: 8,434
Oh, and I believe your parameters for the Format() function are all wrong. The first parameter should be the numeric or date value that you want to format, while the second shows what format to use. You appear to be giving it two strings, the first of which is the format.
Sep 26 '07 #3

jrtox
P: 89
I've got 2 questions ...
Question 1:

Expand|Select|Wrap|Line Numbers
  1. dbEnq.RecordSource = " select * from Enquirer where Date > '" & Format(TxtDate1.Text, "mm/dd/yyyy") _
  2.  & "'" And " Date < '" & Format(TxtDate2.Text, "mm/dd/yyyy") _
  3.  & "'"
  4.  
  5. 'Format(TextName.Text, "mm/dd/yyyy")
Question 2:
No Idea
Sep 27 '07 #4

Expert 5K+
P: 8,434
Can I just point out, it might be better to use the Between operator rather than > and <.
Sep 27 '07 #5

Post your reply

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