Specifying A Date In A GoTo Function
Dec 7, 2004On loading a form is it possible to Go To a record which is within 10 days of today's date?
DoCmd,GoToRecord,acDataForm,"frmClinics",?????????
On loading a form is it possible to Go To a record which is within 10 days of today's date?
DoCmd,GoToRecord,acDataForm,"frmClinics",?????????
I am a teacher trying to build a db to record lesson details. I want to open a form to goto now() and be able to move back and forwards through dates/lessons. The best I have done so far is to query for >=now(), but this obviously does not allow me to see previous days or lessons. I have tried a macro for goto, but this will only allow me to select a record number not a date. I would imagine this is a common requirement of a database, but the solution is evading me. Just a teacher. I thank in advanoe anyone for their time and help.
View 6 Replies View RelatedWhat I really need is for when the form opens, it looks at todays date, then matches current user and then goes to that record for today, if no current user there, then will goto new record..
i know, sounds complicated, and probably is really easy, but my heads not with it today, as about to get drunk as its my 40th, and got people ringing and texting and still trying to get this done....
I've included a copy of this database, named Timecards..
We have a date function that converts a text date format. Can someone help me with time function to do the same thing? We want military time. The field is like this now: txt fields.
160037
213137
224356
235716
235800
12341
21708
22732
Here is the date function we use:
Function f2Date(strDateOld As String)
Dim strDate As String, strMonth As String, strYear As String
strMonth = Mid(strDateOld, 5, 2)
strDate = Right(strDateOld, 2)
strYear = Left(strDateOld, 4)
f2Date = strMonth & "-" & strDate & "-" & strYear
f2Date = CDate(f2Date)
f2Date = Format(f2Date, "mmmm d yyyy")
End Function
Hi all,
I need a little help. In my DB, I have a command button set up (I was tired of typing in dates) for date, but I used the Now function, which also gives me the time.
Now I have over 3000 subrecords of the main ones. I now need to queries transaction for that specific date, but it also retrieves the time.
I tried to go back and change the NOW to DATE in VB, but the code does not run.
How do I change all records that have date and time (using NOW function) and only click that command button to show only the date (mm/dd/yyyy)?
Thanks in advance.
Hi,
Hope this is a nice and simple one. I know I have seen various "last record" references in various threads but I couldn't find one in a search.
I have a command button on my form which navigates you to the next record. I use this rather than the navigation buttons as I can set the tab order to go to it after all the fields are filled. This works fine unless the form is on the last record, in which case it throws up an error. To get round this, I want to test that the current record is not the last record.
It is the test in the If statement I need help with. How do I check that the current record is not the last record in my form? I think it will use the dcount but I don't know how.
Private Sub cmd_Next_Record_Click()
On Error GoTo Err_cmd_Next_Record_Click
If (current record < dcount) then
DoCmd.GoToRecord , , acNext
Else
DoCmd.GoToRecord , , acFirst
End If
Exit_cmd_Next_Record_Click:
Exit Sub
Err_cmd_Next_Record_Click:
MsgBox Err.Description
Resume Exit_cmd_Next_Record_Click
End Sub
Thanks in advance.
Keith.
:confused: Have not worked with access for a long time am trying to update an oldie.
Main form has a sub form. With each new service to customer I select next on the sub forms navigation button. 1 customer might have 6 records on his sub form and another might only have 2.
Problem is that when viewing reports of these visits I need to work on the last service record whereas my sub form always opens to the first record and this is the date read in the reports.
I know it isn’t difficult but I have spent hours on it without success
How can I get the databases to open with all sub forms at last entered record?
Can anyone help ?
Hi all
I want to make an on click event to run the code in another private sub on the same page.
I tried goto and call.... but I haven't got the syntax right.
Any ideas how I can do this??
Thanks
Damon
Hi, got a small problem. As part of a database I have to do for a booking system for a conference centre I have a form (frmSummary) that displays the results of a query (qryT101Book), the query itself displays all the bookings for a certain room from today onwards. This form only displays a summary of the information. I have placed a button on the form to call up the main booking form, (frmBooking) which allows the input of all the data for the booking. On ythis second form, frmBooking, I have placed a button to save the record and update the display on frmSummary. The code I have used for this is Forms![frmSummary].Requery and it works okay, the form is updated. However, tomake it easier to confirm the booking has occurred I would liketo have the cursor move to the last record, i.e. the new booking, on the frmSummary once the command button on frmBooking is clicked. If it was a one record per form situation i would use SetFocus but I'm unsure how to go about this one.
Any ideas please?
Thanks, Lol
I am trying to go to a specific record in a recordset (on a form).
In the past I as using the typical open the form and use the filter to go to the specific record:
strLinkCriteria = "Where ID = 5"
Docmd.openform "frmName", , strLinkCriteria
This takes me to the correct record, but filters the form down to that one specific record. The users instead would like to go to the specific record, but be able to see all the other records for the form correctly.
Is there anyway to do this?
Thank you,
T.J.
I'm requerying a form after an update.
I would like to have the form to be set to its current record when being requeried. How can I easily achieve this?
I've seen things about recordsets, I'm working with ADP (based on SQL Server) and don't know or all DAO events will help me.
OK, I have a couple problems.
One:
I've done this before but I lost the code (and I've been away from DB for a while so I'm very rusty)
I have a form with many records, and in the header of the form, I have a combo box based on the PrimaryKey of the form. I want to select the record from the Combo box and have the form jump to that record.
Two, while actively entering new records into the form, I need the combo box to update to include all entries.
(FYI I am working in Access 2000)
Thanks!
Howdy all,
The other night I was playing around and deleted code from my database, which now seems to have stopped allowing me to continue to a blank form after I add a record....
It used to work, that once I pressed the save button it would then goto the same form but the form would have the same defaults as if id just opened the form.... now im getting #deleted
Is there any code I can put in the save button to get it back to the way it was before?
Cheers Ezy
I have a tab control with 11 pages (departments). Each page have 3 subforms (country, channel, product). Each page can have multiple countries, channels and products.
Example:
Marketing: Country A, Country B and Country C
Country A: Channel A and Channel B
Channel A: Product A, Product B and Product C
So a combination can be:
Marketing in Country A in Channel A with Product A.
I enter several informations (sales, dates, comments etc) on each subform. The subforms are linked (master/child). I store the different primary keys in hidden textboxes.
When I navigate between the pages, the selection resets due to a necessary requery. How can I keep the selection?
Is there a way to search for a term within a form and goto a record that matches that term assuming there was only one matching result (Unique ID, for example).
But NOT filter the results so that user can still navigate as usual after the search has been carried out.
I have created Command buttons on forms with VBA code. Records GoTo previous and GoTo Next Record so both of working is good. But Next Record command is force to a new record. If suppose when we clicking on last record. It is go to new record without any message. So No need to force a new record with Next Record Command. Only just move to next record if there is no records show a message. Below mentioned both VBA codes so there is any changes on GoTo Next Record Code?
VBA Code:
Go To Previous Record : DoCmd.GoToRecord , , acPrevious
Go To Next Record : DoCmd.GoToRecord , , acNext
Is there a way to pass a variable to the GOTO statement?
View 14 Replies View RelatedI'm looking for a simple routine, preferably in the On Key Down or or On Key Press event of a form to quickly navigate to a record based on the key pressed.
I have a form with names in a table layout (continuous form).If the user is on the name field, I'd like it to navigate to the first record that contains first letter of the key pressed. So if a user presses "K", the form will go to the first record that starts with a K.Yes, the names in the form are alphabetical, but in a list with over 100 names, this could speed things up just a bit and save a lot of scrolling and looking.I was thinking of using KeyCode and I already have an event to navigate by the arrow keys so I'm considering building on that.
Code:
If KeyCode = 40 Then ' Down arrow
DoCmd.GoToRecord acForm, Me.Name, acNext
ElseIf KeyCode = 38 Then ' Up arrow
DoCmd.GoToRecord acForm, Me.Name, acPrevious
End If
I am thinking to use a Select Case and add the key codes for all the letters.
Hi Folks,
I know this is possible, just not sure how to proceed or what function to use ... I have a normalized database of unique identifiers, admit data, and discharge date. I am attempted to count only the dates within a certain range between admit and discharge dates for each record. For example, I would like to compute the number of days someone was in admission between #07/01/03# and #06/30/04# only, not counting any days outside of that range.
So if a record has an admit date of 5/3/00 and discharge date of 12/7/03, the value returned would be 159 days, because that is the number of days between #07/01/03# and #06/30/04# the record was enrolled. If a records admit date is 01/01/01 and discharge is 07/26/05, the value returned would be 365 days.
Any ideas?
Thanks,
Joe
Here is what I'm trying to do.
I need a function which takes the current day and finds the date of that weeks Sunday.
Then I need to take that date (of the Sunday) and subtract 13 weeks from it.
This is for the criteria in a query so that the only data displayed will be the previous 13 weeks worth.
Not quite sure how to go about this. TIA for the help.
Should this work? If not is there a way I can achive it! I think its fairly self explanetry :confused:
Private Sub Form_Open(Cancel As Integer)
Me.Date2 = Now()
If Me.Date1 < Me.Date2 Then
Me.Check8 = False
End If
If Me.Date1 > Me.Date2 Then
Me.Check8 = True
End If
End Sub
Hi Guys,
Does anybody know the formula for validating a date in a DOB field.
I want it to only allow dates where the age is at least 18years old.
Something like '<Date()-18' (But a formula that works!)
Thanks in advance!
Hi All,
I have a continious form where each record can be edited. After editing a record the form does a me.save and a me.requery (is important). After this it jumps back to the first record (seems logical), but how can I write a code that he goes back to the 'previous edited record'.
Thanks.
I have a form and subform. The subform is connected to the form and display all BandID's associated with that record. What i want is the ability to click on a record in the subform so that it automatically set's that record in the form for editing.
View 14 Replies View RelatedI want substract from 9/20/2014 totreg40 - reg = ovt but when reg=0 the remainder subtract from 9/19/2014 (previous record) totreg40 - reg = ovt, etc. The sum of reg = 40.
IDFECHA REGOVTTOTREG40
2309/15/2014 5.5 0 46.75
2319/16/2014 8 0 46.75
2329/17/2014 8 0 46.75
2349/18/2014 7.75 0 46.75
2979/19/2014 8 0 46.75
2359/19/2014 8 0 46.75
2339/20/2014 1.5 0 46.75
I want the result like this:
IDFECHA REG OVT TOTREG40
2309/15/2014 5.5 0 46.75
2319/16/2014 8 0 46.75
2329/17/2014 8 0 46.75
2349/18/2014 7.75 0 46.75
2979/19/2014 8 0 46.75
2359/19/2014 2.75 5.25 46.75
2339/20/2014 0 1.5 46.75
Someone fills in a new patient into the database, and the 'chipsoftnummer' which is the number in another database. That number is unique, so i want to have it where if someone fills in a number that already exists in the database the afterupdate event will open that record in the form.Here's the code i put in the input textbox update field:
private Sub chipsoftnummer_AfterUpdate()
Dim NewCHIP As Integer
Dim stLinkCriteria As Integer
Dim custNo As Integer
[code]...
It doesn't work, simple things like hello world do work so VBA is enabled.
I've attached the corresponding part of the database (took out all non-relevant fields and tabs) .