Results 1 to 39 of 39

Thread: [RESOLVED] Problem with Code

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Resolved [RESOLVED] Problem with Code

    Hello,
    The following piece of code I am having an error in. I divided it to two parts to simplify it.
    VB Code:
    1. Dim sConnString As String
    2.     Dim rsTempRecordSet As New ADODB.Recordset
    3.     Dim cnTeamCMI As New ADODB.Connection
    4.     Dim sSQl As String
    5.     strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\ÅÓáÇã\ÓØÍ ÇáãßÊÈ\ÈÑäÇãÌ ÇáÍÖæÑ æ ÇáÇäÕÑÇÝ\database.mdb;Jet OLEDB:Engine Type=5;"
    6.     With cnTeamCMI
    7.         .ConnectionString = sConnString
    8.         .ConnectionTimeout = 0
    9.         .CursorLocation = adUseClient
    10.         .Open strConnString
    11.     End With
    12.         sSQl = "SELECT [ÑÕíÏ ÇáÅÌÇÒÇÊ] FROM [ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "'"
    13.         rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly
    14.     With rsTempRecordSet
    15.  
    16.         If .Fields("ÑÕíÏ ÇáÅÌÇÒÇÊ") >= 1 Then
    17.         cmdMGTHoliday.Enabled = True
    18.         Else
    19.         cmdMGTHoliday.Enabled = False
    20.         End If
    21.     End With
    22. rsTempRecordSet.Close
    23. Set rsTempRecordSet = Nothing
    24. Set cnTeamCMI = Nothing
    This part is fine. But I get the error in his part of code:
    VB Code:
    1. With cnTeamCMI
    2.         .ConnectionString = sConnString
    3.         .ConnectionTimeout = 0
    4.         .CursorLocation = adUseClient
    5.         .Open strConnString
    6.     End With
    7.         sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    8.         rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly
    9.     With rsTempRecordSet
    10.         If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    11.         cmdMGTHoliday.Enabled = False
    12.         Else
    13.         cmdMGTHoliday.Enabled = True
    14.         End If
    15.     End With
    16. rsTempRecordSet.Close
    17. End Sub
    It highlights this line: " If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then" with an error message telling me that either BOF or EIF is True, or the current record has been deleted, the process needs a current record. (The error message is in Arabic I tried to translate as accurate as I could). Any suggestions on how to solve this problem?
    Thanx in advance !

  2. #2
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    It mostly means that the query didn't return any results, so before you actually start fetching data check if .EOF isn't true.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    How can I check it?

  4. #4
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    VB Code:
    1. If not rsTempRecordSet.EOF then
    2.  ' Do your data fetches here.
    3. End if

  5. #5
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Problem with Code

    VB Code:
    1. sSQL = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    2. With cnTeamCMI
    3.     .ConnectionString = sConnString
    4.     .ConnectionTimeout = 0
    5.     .CursorLocation = adUseClient
    6.     .Open strConnString
    7. End With
    8. With rsTempRecordSet
    9.     .Open sSQL, cnTeamCMI, adOpenStatic, adLockReadOnly
    10.     If Not (.EOF And .BOF) Then
    11.         If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    12.             cmdMGTHoliday.Enabled = False
    13.         Else
    14.             cmdMGTHoliday.Enabled = True
    15.         End If
    16.     End If
    17.     .Close
    18. End With
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    But where is the execution statement for your code dee-u? And shouldn't we put this at the end of your code?
    VB Code:
    1. Set rsTempRecordSet = Nothing
    2. Set cnTeamCMI = Nothing

  7. #7
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    not to mention .MoveNext if you have multiple records.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    OK, here is the code that I have at the moment. But it doesn't do anything. (NO errors, nothing at all). By the way could you tell me where would I put the .movenext?
    VB Code:
    1. With cnTeamCMI
    2.         .ConnectionString = sConnString
    3.         .ConnectionTimeout = 0
    4.         .CursorLocation = adUseClient
    5.         .Open strConnString
    6.     End With
    7.         sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    8.         rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly
    9.     With rsTempRecordSet
    10.        If Not (.EOF And .BOF) Then
    11.         If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    12.         cmdMGTHoliday.Enabled = False
    13.         Else
    14.         cmdMGTHoliday.Enabled = True
    15.         End If
    16.         End If
    17.     End With
    18. rsTempRecordSet.Close
    19. Set rsTempRecordSet = Nothing
    20. Set cnTeamCMI = Nothing

  9. #9
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    Don't check on BOF, Begin of File is always true at the start

    VB Code:
    1. With rsTempRecordSet
    2.        While not (.EOF)
    3.            If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    4.                 cmdMGTHoliday.Enabled = False
    5.            Else
    6.                 cmdMGTHoliday.Enabled = True
    7.            End If
    8.  
    9.            .MoveNext
    10.         Wend
    11.     End with

    This query is a bit weird as it probably never will have more then 1 result, it's only useful for more records.. like:

    VB Code:
    1. With rsTempRecordSet
    2.        While not (.EOF)
    3.            lstView.Listitems.Add,, .Fields("Username")
    4.            .MoveNext
    5.         Wend
    6.     End with

    Kinda like that, it just moves the record up or down by one notch (depending how you look at it hehe). As soon as it hits the end EOF is set to true and thus the While loop ends.

  10. #10
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Problem with Code

    Quote Originally Posted by ielashi
    But where is the execution statement for your code dee-u? And shouldn't we put this at the end of your code?
    VB Code:
    1. Set rsTempRecordSet = Nothing
    2. Set cnTeamCMI = Nothing
    I just tried to fix your code, so it is still your code and not mine...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    But I was wondering how come the first one worked? Anyways, here is the code I have right now. Still it doesn't function. I think it's because EOF is true so it doesn't process the If statement. Is there like a command to set it to false or something else that would fix this?
    VB Code:
    1. With cnTeamCMI
    2.         .ConnectionString = sConnString
    3.         .ConnectionTimeout = 0
    4.         .CursorLocation = adUseClient
    5.         .Open strConnString
    6.     End With
    7.         sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    8.         rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly
    9.     With rsTempRecordSet
    10.        While Not (.EOF)
    11.            If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    12.                 cmdMGTHoliday.Enabled = False
    13.            Else
    14.                 cmdMGTHoliday.Enabled = True
    15.            End If
    16.            .MoveNext
    17.         Wend
    18.     End With
    19. rsTempRecordSet.Close
    20. Set rsTempRecordSet = Nothing
    21. Set cnTeamCMI = Nothing

  12. #12
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    Ehh don't use the While statement for 1 record, just use the IF statement.

    Something like this:
    VB Code:
    1. With rsTempRecordSet
    2.        If Not (.EOF)
    3.            If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    4.                 cmdMGTHoliday.Enabled = False
    5.            Else
    6.                 cmdMGTHoliday.Enabled = True
    7.            End If
    8.        Else
    9.              cmdMGTHoliday.Enabled = True
    10.        End if
    11.     End With

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Sorry for late reply, I tried what you said, I am not getting any errors now, but it's not doing what I want. It skips the if statement that I have as EOF is always true. Here's the code I have at the moment:
    VB Code:
    1. With cnTeamCMI
    2.         .ConnectionString = sConnString
    3.         .ConnectionTimeout = 0
    4.         .CursorLocation = adUseClient
    5.         .Open strConnString
    6.     End With
    7.         sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    8.         rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly
    9.     With rsTempRecordSet
    10.        If Not (.EOF) Then
    11.            If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then
    12.                 cmdMGTHoliday.Enabled = False
    13.            Else
    14.                 cmdMGTHoliday.Enabled = True
    15.            End If
    16.        Else
    17.              cmdMGTHoliday.Enabled = True
    18.        End If
    19.     End With
    20.  
    21.  
    22. rsTempRecordSet.Close
    23. Set rsTempRecordSet = Nothing
    24. Set cnTeamCMI = Nothing

  14. #14
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: Problem with Code

    It skips the if statement that I have as EOF is always true
    That's why there is a Else... statement. If there is no record returned you can put the code in the else statement. I put cmdMGTHoliday.enabled = true there as I assumed that would be the default.

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    I understand what you mean. But the problem is that I'm POSITIVE there are records matching my query.

  16. #16
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    Re: Problem with Code

    Why don't you stick a

    MsgBox rsTempRecordSet.recordcount

    after you run the sql statement just to see if it is returning a record or not.
    Here's to us!
    Who's like us?
    Darned few, and they're all dead!

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    What if we use WHERE EXISTS in the SQL SELECT statement, would that work?

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Thanx for the advice demotivator, I'll give it a shot

  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    OK, I seem to understand the problem and it's almost fixed. I'm trying now to make an if statement for multiple database fields, I think my syntax is incorrect. Here it is:
    VB Code:
    1. If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" And .Fields("ÊÇÑíÎ ÇáÏÎæá") = "'" & Format(Now, "dd/mm/yy") & "'" Then
    2.             cmdMGTHoliday.Enabled = True
    3.         Else
    4.             cmdMGTHoliday.Enabled = False
    5.         End If
    Any ideas about the basic syntax for the if statement above would be greatly appreciated. By the way, do all the fields in the if statement above must be in the SELECT SQL statement?

  20. #20
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    Re: Problem with Code

    That looks ok to me. And yes, the fields have to be in the sql statement.

    You may also want to check if the fields you have retreived are null before doing any work with them.

    ie:

    If isnull("youfield") = false then
    'do you stuff
    Else
    'can't do your stuff, the field is null
    End If
    Here's to us!
    Who's like us?
    Darned few, and they're all dead!

  21. #21
    Member Dennis DVR's Avatar
    Join Date
    Jul 2005
    Location
    Manila Philippines
    Posts
    54

    Re: Problem with Code

    Hope you guys don't mind if I hop in

    Quote Originally Posted by Devion
    Don't check on BOF, Begin of File is always true at the start
    Do you mind explaining this one?

    BTW IMHO the proper way of determining whether the result returned by a query is empty is by cheking both EOF and BOF not just BOF nor EOF


    To ielashi

    if you are assigning the value of your fields to a textbox or other control then demotivater is quite correct you should check the value of your fields whether it is NULL or not before passing it to a textbox control etc.., but another method would be to just add a vbNullString or "" (empty string) and eliminate the If block.

    BTW Format will already return string why do you need to add a single quote (') in the result?

  22. #22

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Thank you. Actually one of the fields of my if statement wasn't in the SELECT SQL statement, so I had to write it again. But there seems to be a problem in it which puzzles me. It just tells me that are no records for it although there is in the database data matching my query. Here is my statement:
    VB Code:
    1. sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [æÞÊ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#"
    Any suggestions?

  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    DENNIS DVR, I can't really understand what you mean. Can you put it an example code to make more clearer?

    BTW Do the fields have to actually be null so I can work with them?

  24. #24
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    Re: Problem with Code

    Are you sure you want to be searching the database for the List Index?

    [edit]Whoops, nevermind, misread your code[/edit]
    Last edited by demotivater; Aug 19th, 2005 at 10:37 AM.
    Here's to us!
    Who's like us?
    Darned few, and they're all dead!

  25. #25
    Member Dennis DVR's Avatar
    Join Date
    Jul 2005
    Location
    Manila Philippines
    Posts
    54

    Re: Problem with Code

    Are you sure that [æÞÊ ÇáÏÎæá] is a date datatype? and the format is dd/mm/yy?

    BTW you are asking example? to what?

  26. #26

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    No no, you see, it's looking for the name I clicked on in the listbox. This part's fine. The problem I think is in the last part, with the date thing.

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Yes, it is a DateTime field. I was asking example regarding the vbnullstring. And do the fields have to be null so that I can work them?

  28. #28

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    I substituted the fields in the SQL statement with relevant ones in English to make things a little clearer.
    VB Code:
    1. sSQl = "SELECT [Holiday] FROM [Employee Timings] WHERE [Employee Name] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [Punchin Time] = #" & Format(Now, "dd/mm/yy") & "#"

  29. #29

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Could someone please tell me what's wrong with this if statement, been trying to work on it forever, I just don't know what's wrong. There are no errors formaed, but the value of the field I entered did not match. Needs to be rephrased I guess. Anyone have any ideas?
    VB Code:
    1. If .Fields("ÊÇÑíÎ ÇáÏÎæá") = "#" & Format(Now, "dd/mm/yyyy") & "#" Then
    2.             cmdMGTHoliday.Enabled = False
    3.         Else
    4.             cmdMGTHoliday.Enabled = True
    5.         End If

  30. #30
    Member Dennis DVR's Avatar
    Join Date
    Jul 2005
    Location
    Manila Philippines
    Posts
    54

    Re: Problem with Code

    Quote Originally Posted by ielashi
    Yes, it is a DateTime field
    But how about the format is it really dd/mm/yy?
    Quote Originally Posted by ielashi
    I was asking example regarding the vbnullstring
    If you are passing the value of your fields to a textbox control etc.. then you could do something like
    VB Code:
    1. Text1.Text = vbNullString & .Fields("YourField").Value 'It will not give you an error even if .Fields("YourField").Value is NULL
    This one will throw an error if .Fields("YourField").Value is NULL
    VB Code:
    1. Text1.Text = .Fields("YourField").Value
    But as far as I can see it you are not passing the value of your fields to a textbox control etc.
    Quote Originally Posted by ielashi
    And do the fields have to be null so that I can work them?
    No, it doesn't have to be NULL to be able for you to work with then

    and did you removed the single quote in your IF statement? i.e.
    VB Code:
    1. If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" And .Fields("ÊÇÑíÎ ÇáÏÎæá") = Format(Now, "dd/mm/yy") Then

  31. #31

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Actually, I modified the SELECT SQL statement minorly and therefore the if statement has changed. Please take a look at my previous post and inform me if you see any error in it.

  32. #32
    Member Dennis DVR's Avatar
    Join Date
    Jul 2005
    Location
    Manila Philippines
    Posts
    54

    Re: Problem with Code

    I don't think you need a pound or number sign there

  33. #33

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    OK, I removed them and the line now looks like this:
    VB Code:
    1. If .Fields("ÊÇÑíÎ ÇáÏÎæá") = " & Format(Now, "dd/mm/yyyy") & " Then
    But do you know that ASCI thing which replaced this double apostrophe " because it's giving me an error because of that.

  34. #34
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Problem with Code

    Take the quotes out.... you do not need them....
    VB Code:
    1. If .Fields("ÊÇÑíÎ ÇáÏÎæá") = Format(Now, "dd/mm/yyyy")  Then

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  35. #35
    Member Dennis DVR's Avatar
    Join Date
    Jul 2005
    Location
    Manila Philippines
    Posts
    54

    Re: Problem with Code

    Post #30

  36. #36

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    Tried removing quotes but still doesn't work

  37. #37
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Problem with Code

    What doesn't work? Why? What? Where?
    [snarky=on]Saying it doesn't work does the rest of us no good. That's walking into the doctor's office and say it hurts. He's going to ask what hurts. Ok, so it doesn't work? Well, why not? What kind of errors do you get? HOW do you know it isn't working?[/snarky]

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  38. #38

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Problem with Code

    What I meant was that when I removed the quotes from the If statement it doesn't work. It doesn't show any errors because it is skipped by another if statement because it doesn't math the field database. But no problem, I made another alternative. Instead of making the if statement on this datetime field, I made it based on another string field. It works now, but thank you people so much for your help.

  39. #39
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [RESOLVED] Problem with Code

    Usually I do it this way...

    VB Code:
    1. If DateValue(.Fields("ÊÇÑíÎ ÇáÏÎæá")) = DateValue(Date) Then
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width