Rather than using the 'Navigation' offered by MS Access I would like to have 2 text boxes, one that shows the total number of records in a recordset (DCOUNT works here) and one that shows the number of the current record, incrementing or decrementing as I click on the 'Next' and 'Previous' command buttons.
Does anyone know if there is there a function that does this?
How can I iterate over all the records in a table and get each value from a field in each record? I want to get each value from the field, do something to it, then add it to a combobox. Is there a way to do this simply?
i have a combobox with two subforms and 1 main form.
the mainform is based on a query When i scroll, the records change, and the subforms corespond properly. BUT, when i use the combobox to change the records, i cant select anything. I see the list in the combox, but when i click i get the message: Cannot change value. Type autonumber.
Can i get rid of the record navigation bar at the bottom of a form? if so i can have a control button that will go the next record but how can i stop 2 people going to the same record?
Ok, I am trying to make some sort of thumbnail preview form. The image appears in the imgBox no problem, and it is grabbing it from the field. When I use a combo box to navigate the records it works flawlessly
HOWEVER, I would like my users to be able to press bckwds/fwds arrows so i made some arrows with the wizard and added some code. Heres how it looks
--------------------------------------- Private Sub cmdNext_Click() On Error GoTo Err_cmdNext_Click
DoCmd.GoToRecord , , acNext Me.Requery If Me!SamPhoto = "" Or IsNull(Me!SamPhoto) = True Then imgSamPhoto.Picture = "" lblNoPhoto.Visible = True Else lblNoPhoto.Visible = False imgSamPhoto.Picture = Me![SamPhoto] End If MsgBox Me!SamPhoto Exit_cmdNext_Click: Exit Sub
Private Sub Form_Load() DoCmd.GoToRecord , , acFirst End Sub
------------------------------------------
My problem is that it never goes to the second record when i press next, and when i press back it says at end of recordset ( which makes sense ) but why would the back button work, and the fwd button do nothing ? I am hoping it is a small syntax error. Please help!
Hi there I found alot of nice tips here, thanks for that :) But I havent found exactly what I am looking for. I will keep searching but I thought I would post as well.
Here is my problem : I have to design a form that works like an old application form written in VFP7.
Basically a combo box chooses a customer, another combo box filtered by customer chooses a job. A third combo box filtered by Jobs chooses a stock.
There is a subform linked by Stock_ID that displays details of the stocks, amounts, locations, etc...
I want to limit record navigation to these combo boxes. Right now even with navigation buttons hidden and limiting tab cycle to current record; a user can use the mousewheel and page up / page down keys to change the current record in Stock table and thus changing the details in my sub form.
Does anyone know of a way to stop all record navigation unless I explicitly move the record pointer via code behind the combo boxes?
I will keep looking around here and will likely play with the Current event to reverse any changes made to the record pointer but it does not seem the best way to handle this.
I am trying to do a search for my Access form using a combo box. It works when I search by a field called institution. But I want the records to be displayed in descending order by date rather than by Id. What should I add to my code.
Code: Private Sub Combo21_AfterUpdate() Dim rs As DAO.Recordset Set rs = Me.RecordsetClone rs.FindFirst "[INSTITUTION] = """ & Me.Combo21 & """"If rs.NoMatch ThenMsgBox "No Act Account for company selected."Else 'Display the found record in the form.Me.Bookmark = rs.BookmarkEnd IfSet rs = NothingEnd Sub
Also I want users to perform a search by selecting an institution from one combo box then a date from another box. Any help on this would be greatly appreciated.
I have a little problem and do require help in fixing it. I am only 3% away from finishing the database (due today) but have a little bit of a problem on my hands. here it is:
I have a counter on my form that tracks which record is currently being viewed. the code for the counter is:
------counter code--------- 'Provide a record counter for using with ' custom navigation buttons (when not using ' Access built in navigation)
Dim rst1 As DAO.Recordset Dim lngCount As Long
Set rst1 = Me.RecordsetClone
With rst1 .MoveFirst .MoveLast lngCount = .RecordCount
End With
'Show the result of the record count in the text box (txtRecordNo) If Me.CurrentRecord = lngCount Then Command126.Enabled = False Command129.Enabled = False Else Command126.Enabled = True Command129.Enabled = True End If Me.txtRecordNo = "Record " & Me.CurrentRecord & " of " & lngCount & " record(s) for " & [CLIENT PREFIX] Me.Text292 = "Record " & Me.CurrentRecord & " of " & lngCount & " records" ----------counter code---------
On the same form, I have a delete button. The button deletes the current record that is being viewed (user prompted before it is deleted). The code for that button is as follows: ----delete code----- Private Sub command271_Click() On Error GoTo Err_cmdDelete_Click
DoCmd.SetWarnings False If MsgBox("Are you sure you want to delete this Audit and its associated measures?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdDeleteRecord
CLIENT_NAME.SetFocus End If Exit_command271_Click: DoCmd.SetWarnings True Exit Sub Err_cmdDelete_Click: MsgBox Err.Description Resume Exit_command271_Click End Sub -------delete code--------
This button also works fine with the exception of the following. THE MAIN PROBLEM: example I have a client that has 5 different entries in my database (5 diff. facilities) and I want to delete one of their facilities. I would simply use my 'search' form and then navigate to the facility that I would want to delete. If that facility is facility 1, 2, 3, or 4 then I have no problems. The system deletes the selected record and then simply displays the one after. The PROBLEM is when you are trying to delete the 5th record. When the fifth (in this example, it could be the 9th record for any other client, as long as it is the last one) is the one to be deleted, an error occurs. When you hit the debug button the following line from the counter is highlighted: .MoveLast
I have solved this problem and I no longer get an error message BUT when the last record is deleted, the database simply loads a new and empty form that will accept data. I DO NOT WANT THIS TO HAPPEN. I want it to be set up as follows: If the last record (not the ONLY record, but the last record on file) is the one that is to be deleted THEN delete that record and load the one prior If there is ONLY ONE record, then delete it and load the main form.
Hi all, We have an Access 2000 db on a server that I can open. Problem is, when other users open it up and use the Navigation buttons to say, view the next record, Access crashes with the following error: "Method 'Requery' of object '_Subform' failed." (this is the Access supplied record navigation functionality - I havent customised it in any way)
Other users have been using it before with no problem (upto last week). I can still open the db and do not have any errors... So, it appears to be a user related problem.
Any suggestions or things I should check out, please?
The control source for the text box is a Number field called FileNo in a Table called File. THe default value of the text box is 0.
When the button is clicked a value is calculated using the last value under FileNo in the Table.
The problem is that I have to either navigate the records or close the form in order to save the new value onto the Table.
I need to be able to save a new value to the Table as soon as it is generated without having to close or navigate. So that I get some new value everytime I click the button without closing the Form. (when the button is clicked 1 will be added to the last value under FileNo on Table File)
The control source for the text box is a Number field called FileNo in a Table called File. THe default value of the text box is 0.
When the button is clicked a value is calculated using the last value under FileNo in the Table.
The problem is that I have to either navigate the records or close the form in order to save the new value onto the Table.
I need to be able to save a new value to the Table as soon as it is generated without having to close or navigate. So that I get some new value everytime I click the button without closing the Form. (when the button is clicked 1 will be added to the last value under FileNo on Table File)
I am using Access 2007 and am a former user of an old flat-file 32 bit program under Windows 3.x. I am fairly new to MS Access 2007. I run a filter or query, which will return X number of records. Then, I will search those X records by specific text, such as "assist" from the record navigation buttons. I search for "assist" and the text will be highlighted each time it is found in any text or memo field in the record. Hitting Enter takes me to the next occurrence and highlights the text. If "assist" occurs in 4 fields in a record, for instance, it will be highlighted in each of those 4 fields one by one as I hit Enter. The next Enter takes me to the next record and will then continue to the next occurrence of assist" in any of its fields. It will continue to highlight "assist" in those fields, in succession, until the last occurrence in all of those records is found, in which case Enter does not return "assist" anymore because the last occurrence has already been found.
This does not always work. Often, I get every occurrence of "assist," but in the current record only, even though the word exists in other remaining records that were returned with my original filters/query.
I've spent far too long searching for the answer to this. On my form's onCurrent event I want to check if I am on the last record and if so, disallow navigating to the next "record" which is blank. I'm not sure why Access will let this happen to begin with when selecting Next Record. Isn't that what New (blank) record is for?
To briefly explain my database; it is a bespoke referral management system within a hospital. Each record on the database contains patient demographic information, as well as information on their referral (i.e. date of referral, date of assessment, date of commencing treatment, discharge date etc.) Therefore, the same patient will appear multiple times in the database, with each separate record corresponding to a unique referral pathway.
The database forms are split to show patient information at the top, with referral information shown in a subform. I am trying to add navigation buttons to the subform that will allow the user to scroll through the referrals corresponding to the patient currently displayed on the main form.
Each patient has a uniquely identifiable number associated with them, and so it seems straightforward enough in my mind to have a button that will search for the record in the database where the patient's number matches the patient number of the current record, and where the referral date is minimum (for "First Referral"), maximum but less than current (for "Previous Referral"), minimum but greater than current (for "Next Referral"), and maximum (for "Last Referral").
I would like to know if there is any procedure to restrict/stop auto number increment for certain number of record count (say 50), then increment by 1 for next 50 records.
I have made a navigation form that prints the current record out as a PDF and also the option to send the current record by email as a PDF. Both work perfect when you open the form outside the navigation form. But when you open it inside the navigation form, it does not print any of the information.
The problem is in the Query report, In the criteria box for field [RequsetID] it has
I have a data base in which there is a table where each record describe properties of one fishing trip. The first column in the table is a number (unique but not autonumber format) and I already made 10,000 records with only this index number . Now me and others in my lab are entering data to this table for each of the records.
The data entry is done using form which show one record at a time (lets call it "sail_info_F").
I made another form which has only two elements:
1. text box in which I enter a number 2. button which opens the data entry form ("sail_info_F") showing the record with the same index number as the number I enter on the text box.
(the code for this button is "DoCmd.OpenForm "sail_info_F", , , "[RECORD_NUMBER]=" & Me.TEXT_BOX_NAME"
So far so good and it does open the form in the wanted record. BUT when the form opens I can't use the buttons I have placed in this forms which move between records. Those were made with the wizard, and are working OK when I open the form directly without using the second form (The one which opens "sail_info_F" on a specific record).
I am not able to disable NavigationButton when i login navigation form using login form. I am using MS access 2007 - 2010.i am using below code but getting error.
create a macro that automatically fills in the next invoice number in sequence",,I'm assuming this macro would look at the value of the previous record and add a one to itI don't want to use a AutoNumber field as I might need
on main form i have 6 buttons to take me to different forms. these other forms display different details relating to the same record im looking at on main form.
SO, i hit the record navigation button and it flicks to show record 2's details, then i hit my button and it takes me to my new form BUT starts from record 1, i want it to show the current record in looking at on main form.
i feel ashamed asking this, must be simple thing to do.
I have a main form and a sub form. when a record is clicked on the sub form I would like to change a textbox on the main form to say "You are on record number 8 of 10.
Do you have any idea's how I can tell what record number they are on;-