473,395 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

i need help here...

143 100+
Hi everyone..
I have a form called "showreminder". in this form i have 2 dtpicker 1 command button and 1 datagrid : DTPfromDt and DTPtoDt and cmdshowreminder, and MSHFlexGrid1...
this form has to connect to one more form which is called as "reminders". in this form i have : txtid,txtcaseid,txtreminder,cmbreminderby,txtremin dto,dtpentrydt,dtpclosedt..

when i select the fromdate and todate in my first form and press the commandbutton cmdshowreminder it has to connect to my second form and the gird has to show the data which its there between these selected date..

i m trying to write a prcedure for tht bt its not working
is it any way tht i can do it in the form and code itself???
plz help me here
thanks
Jan 12 '09 #1
12 1675
squrel
143 100+
i m trying this code bt my grid is coming empty
how to connect the fromdt and todt from this form to the other form wit entrydt and closedt?



Private Sub cmdshowreminder_Click()
Dim sQuery As String
If FieldName = "DTPfromdt" And FieldName = "DTPtodt" Then
sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6), reminder, reminderby, reminderto From reminders"

Adodc1.ConnectionString = pStrConnectionString
Adodc1.RecordSource = sQuery
Adodc1.Refresh
Set frmReminders.MSHFlexGrid1.DataSource = Adodc1
Set frmReminders.MSHFlexGrid1.Recordset = Adodc1.Recordset
Adodc1.Refresh
frmReminders.MSHFlexGrid1.ColWidth(1) = 500
frmReminders.MSHFlexGrid1.ColWidth(2) = 500
frmReminders.MSHFlexGrid1.ColWidth(3) = 1000
frmReminders.MSHFlexGrid1.ColWidth(4) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.Refresh
end if
End Sub
Jan 12 '09 #2
QVeen72
1,445 Expert 1GB
Hi,

Post the Code here, If there is any problem with the code, we can let you know.. Also, What format is the date Displayed in the FlexGrid..?

Regards
Veena
Jan 12 '09 #3
squrel
143 100+
[img]file:///C:/DOCUME%7E1/AZITA%7E1.MOS/LOCALS%7E1/Temp/moz-screenshot.jpg[/img]this is my code and my date format is mm/dd/yyyy
my grid is empty when i click on cmdshowreminder
how can i connected these 2 tables together and get the grid according to selected date
thank u



Private Sub cmdshowreminder_Click()
Dim sQuery As String
If FieldName = "DTPfromdt" And FieldName = "DTPtodt" Then
sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6), reminder, reminderby, reminderto From reminders"

Adodc1.ConnectionString = pStrConnectionString
Adodc1.RecordSource = sQuery
Adodc1.Refresh
Set frmReminders.MSHFlexGrid1.DataSource = Adodc1
Set frmReminders.MSHFlexGrid1.Recordset = Adodc1.Recordset
Adodc1.Refresh
frmReminders.MSHFlexGrid1.ColWidth(1) = 500
frmReminders.MSHFlexGrid1.ColWidth(2) = 500
frmReminders.MSHFlexGrid1.ColWidth(3) = 1000
frmReminders.MSHFlexGrid1.ColWidth(4) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.Refresh

end if
end sub
Jan 12 '09 #4
squrel
143 100+
wld u plz check my code and help me out in this matter..
thank u
Jan 12 '09 #5
QVeen72
1,445 Expert 1GB
Hi,

Change Your Query Like this :

Expand|Select|Wrap|Line Numbers
  1. sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6), " _
  2. & " reminder, reminderby, reminderto From reminders Where reminddt "  _
  3. & " Between #" & Format(Form1.DtpFrom.Value,"dd-mm-yyyy") & "# " _
  4. & " And #" & Format(Form1.DtpTo.Value,"dd-mm-yyyy") & "# " 
  5.  
Change datepicker control names accordingly...

Regards
Veena
Jan 12 '09 #6
squrel
143 100+
i have changed the code the way u told me bt sitll my gird is empty.. there is no error coming bt nothing showing in the gird



Private Sub cmdshowreminder_Click()
Dim sQuery As String
If FieldName = "DTPfromdt" And FieldName = "DTPtodt" Then
sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6), " _
& " reminder, reminderby, reminderto From reminders Where reminddt " _
& " Between #" & Format(frmShowReminder.DTPfromDt.Value, "dd-mm-yyyy") & "# " _
& " And #" & Format(frmShowReminder.DTPtoDt.Value, "dd-mm-yyyy") & "# "
Adodc1.ConnectionString = pStrConnectionString
Adodc1.RecordSource = sQuery
Adodc1.Refresh
Set frmReminders.MSHFlexGrid1.DataSource = Adodc1
Set frmReminders.MSHFlexGrid1.Recordset = Adodc1.Recordset
Adodc1.Refresh
frmReminders.MSHFlexGrid1.ColWidth(1) = 500
frmReminders.MSHFlexGrid1.ColWidth(2) = 500
frmReminders.MSHFlexGrid1.ColWidth(3) = 1000
frmReminders.MSHFlexGrid1.ColWidth(4) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.Refresh
End If
End Sub
Jan 12 '09 #7
squrel
143 100+
i m still not getting anything in my grid.... is my query rit?
plz help me in this matter
Jan 13 '09 #8
QVeen72
1,445 Expert 1GB
Hi,

I Guess, You are using SQL Server, My Query was for access..
Slight change in syntax:

" MyFldDate Between Convert(Datetime,'" _
& Format(dtpF.Value, "mmm dd yyyy") & "') And " _
& " Convert(Datetime,'" & Format(dtpT.Value, "mmm dd yyyy") & "')"


Regards
Veena
Jan 13 '09 #9
squrel
143 100+
Hi Veena,
i m sorry to trouble... yes i m using sqlserver 2000 and VB6
i paste the query bt the problem when i go to debug my field name is showing empty and directly is coming out of if loop and goes to end if and end sub it does not go through the squery and the grid thts why is not showing anything in my grid.. bt does not understand why?? i m pasting the code here wld u plz check it out.. in the line which i made it bold shows the field name is empty and directly goes to the end if and and does not read anything...
anything wrong in tht line??
thank u



Private Sub cmdshowreminder_Click()
Dim sQuery As String
Dim FieldName As String

If (FieldName = "DTPfromdt" And FieldName = "DTPtodt") Then


sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6)," _
& " reminder, reminderby, reminderto From reminders,showreminder Where reminddt Between Convert(Datetime,'" _
& " Between " & Format(frmShowReminder.DTPfromDt.Value, "dd-mm-yyyy") & " #" _
& " and " & Format(frmShowReminder.DTPtoDt.Value, "dd-mm-yyyy") & ""

Adodc1.ConnectionString = pStrConnectionString
Adodc1.RecordSource = sQuery
Adodc1.Refresh
Set frmReminders.MSHFlexGrid1.DataSource = Adodc1
Set frmReminders.MSHFlexGrid1.Recordset = Adodc1.Recordset
Adodc1.Refresh
frmReminders.MSHFlexGrid1.ColWidth(1) = 500
frmReminders.MSHFlexGrid1.ColWidth(2) = 500
frmReminders.MSHFlexGrid1.ColWidth(3) = 1000
frmReminders.MSHFlexGrid1.ColWidth(4) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.ColWidth(5) = 2000
frmReminders.MSHFlexGrid1.Refresh
End If
End Sub
Jan 13 '09 #10
QVeen72
1,445 Expert 1GB
Hi,

Why are you checking this line..?
If (FieldName = "DTPfromdt" And FieldName = "DTPtodt") Then

Remove that IF condition..
Since you are declaring the FieldName there itself, it would be blank, and hence cannot enter IF condition


Regards
Veena
Jan 13 '09 #11
squrel
143 100+
ok.. i have removed the if loop bt its giving me error as :

"Incorrect syntax near the keyword 'between' . and after tht it gives me error as : "method 'Refresh' of object 'IAdodc' failed"

i have tried 2 types of query... bt still is giving me error ..

1)

sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6)," _
& " reminder, reminderby, reminderto From reminders,showreminder Where reminddt & " _
& " Between Convert(varchar(20),frmshowreminder.DTPfromDt,6) And " _
& " Convert(varchar(20),frmshowreminder.DTptodt,6) & "


2)

sQuery = "select id, caseid,convert(VarChar(20), reminders.reminddt, 6)," _
& " reminder, reminderby, reminderto From reminders,showreminder Where reminddt & " _
& " Between Convert(Datetime,'" & Format(frmShowReminder.DTPfromDt.Value, "dd-mm-yyyy") & "') And " _
& " Convert(Datetime,'" & Format(frmShowReminder.DTPtoDt.Value, "dd-mm-yyyy") & "')"


i dont knw really wht is the problem.... the query is working in query analyzer bt giving me error in VB... wht else i have to do???? :(((((((((((
Jan 13 '09 #12
squrel
143 100+
Thank u very much
finally i got it :)))
Jan 13 '09 #13

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

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
5
by: Y2J | last post by:
I am working through this book on C++ programming, the author is speaking of using linked lists. He gave and example which I found confusing to say the least. So I rewrote the example in a way that...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
0
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...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.