the problem is that I am not very good on SQL all i was able to do is come up with inner join and return top 1 record descending so it selects last record. can you show me an example how you would do this sql code? say my first table is tblmain and another 1 is tblholidays which is related tblmain (1 to many) tblholidays.
thank you I would be apreciated if you could help me.
User Profile
Collapse
Profile Sidebar
Collapse
breakdance89
Last Activity: Feb 12 '13, 02:58 PM
Joined: Jan 29 '13
Location:
-
vb6 and mysql or loop to select certain dates in the database
I have been scratchin my head all night. I want to program holiday reminders as when you book a holiday you could be reminded that is comming up for your employees.
to explain it shortly what I want to is:
-join two tables in the database Table 1 and table 2 which is also related table1 (1 to many) table 2
-select last record in table 2 accordingly to table 1 id
now what I have managed to do is... -
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual Basicfinally! thanks for all your help i got it cracked, just needs loads of testing now but looks good, by the way I didn't come here to ask people to write me code.
here is what I wrote and it works. no loops just simple logic
...Code:Public Sub newWeekCheck() Dim res As Integer Dim tDate As Date Dim NumD As Integer Dim adddate As String adddate = str(DateAdd("d", 1, Format(Now, "dd-mm-yyyy")))Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual Basichow would you implement this? I do not want the user to be typing it, i want it to be added there automatically. any sample code? thank youLeave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicI think I am going to need a text file or something like that to store that date and the compare it and at some point rewrite it againLeave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicBecause I would not have any values to do a check from. If I do a check from msflexgrid.text matrix(1,7) before the loop I would have nothing in that row to do a check from.Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicI assume if I don't repopulate it then the dates will change automatically but I don't want that to happen, I want it to stay the same for 14 days but as soon as 8 days lapses then it assumes its a new week and starts to loop it againLeave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicBecause I am repopulating the dates on the rota. So now hopefully it will do a check and if it returns true then it should repopulate and the dates should be staying the same. Then i can do another check when current date is greater than it is on the second Row like day 14. Then loop it through to add dates starting from 15th. What do you exactly mean by running it twice on the same row?Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual Basic...Code:Dim*f*As*Integer dim*tDate*as*Date tDate*=*now ****For*f*=*1*To*7 *******tDate*=*Format(tDate,*"d/m/yy") *******grdRota.TextMatrix(1,*f)*=*DateAdd("d",*f*-*1,*tDate) ***Next*f tdate = now Dim dtcheck as date dtCheck = grdrota.textmatrix(1,7) If tdate>dtcheck then tdate=now -7 ****For*f*=*1*To*7 *******tDate*=*Format(tDate,*"d/m/yy")Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicThe problem is I don't know What value could be used to determine that the week is over.Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicI tried to reset the values putting in an if statement in the loop to check if it's a new week but it is not working. How would you reset the counter?Leave a comment:
-
breakdance89 replied to dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual BasicBasically my program generates rota from access database. But I want my dates to be added automatically. Which that what the code does. To see create a new form and add msflexgrid control on it set cols to 8 and paste the code in form initialize event. Also need to declare tdate as date. My problem is I want to create rota for 2 weeks either using one msflexgrid control or 2. What happens now is when dates are looped on the grid it changes as soon...Leave a comment:
-
breakdance89 started a topic dates and msflexgrid problem trying to loop dates on a grid control for 2 weeksin Visual Basicdates and msflexgrid problem trying to loop dates on a grid control for 2 weeks
I have this code which puts correct dates on msflexgrid control for weekly rotas on my program. What it currently does is checks which day is monday and the loops it through creating dates accordingly to as monday, tuesday etc.
now I have a problem trying to create a rota for 2 weeks instead of one. if i just copy the code it will work for the time being but as soon as that week is over both rotas just skip a whole week instead of running...
No activity results to display
Show More
Leave a comment: