I have a table that displays a list of entries - this table was being displayed in datasheet mode.
I wanted to be able to control the ability to edit records on the datasheet so have created a form that displays in continuous view so that I can turn off editing.
The problem is that the form is not actually retrieving the data from within the table and displaying it in the form.
I have no idea what is causing the data not to populate.
The form uses the table as its record source and all the controls are set to the correct columns in the table.
I am hoping that this makes sense.
It would perhaps be an idea to post a sample of your data - obviously dummy values that are confidential but ensure that your sample is an accurate reflection of what you're working with.
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
Of course ... Sorry ... when I posted this I was getting flustered with not being able to find any way to fix the issue.
Here is the sample.
I realise now that my post may also not have been too clear so I'll update things now that I am thinking a little better.
As you will see by looking at the database there are several functions.
The ones that have issues are:
the "view all" button - what it originally did was displayed the contents of the "movie database list" table directly in datasheet view.
The problem I have with the way that works is that the datasheet view can be edited directly without requesting any confirmation at all so edits can be made by mistake and then the table updates automatically without asking for confirmation - My first thought was to lock the datasheet and then put an edit button on there - my online searches have all said that cmd buttons and controls cannot be added to the datasheet - so next I tried to create the form "continuous view form" so that I could lock everything and add edit button - for some reason this form is returning only a singular row instead of the complete datasheet view that it should be showing and I don't know how to fix this.
Second - the "search movies" button - If you click the search button without inputting criteria it displays the complete table - I would prefer it to show a msg box that says something like "please type in some search criteria and try again" and if the search criteria that they try to search for does not match any existing entries then a msg box stating "no matching results could be found, pls try again"
I do have a msg box code in the search button but it is not working as expected.
Adjust the size of your form in design view to include only the one line of controls. Approximate height of 1/2 inch. You currently have the form shown at about 8 inches. Currently if you scroll down using the scroll bar on the right all the records will appear but separated by a lot of space.for some reason this form is returning only a singular row instead of the complete datasheet view that it should be showing and I don't know how to fix this.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Thanks Alan.
I have now fixed that issue.
Next question:
Is it possible for me to select a LINE from the continuous view form and then use command buttons to edit or delete the record ?
Would it work as a line selection or would each of the individual controls in said line need to be selected and used ?
The edit button would need to unlock the individual line only. (the form is currently edit locked).
Last edited by vampyr07au; 04-24-2011 at 09:16 AM.
First off, I haven't ever used continuous forms (I personally don't like how they operate or look, but that is my perspective) so I am only guessing at some possibilities. I would try putting a command button on the form and see what happens. If you don't get your results, try putting the command button in the header or footer instead of directly on the form. If none of this works for you, then you might try using google for a solution.
You will need some sort of VBA code similar to:
You will have to list all your textboxes. And most important, this code is untested.me.textbox.allowedits=True
As an aside, will this db be used by someone other than yourself? Will the other users be making edits? If there are no other users than yourself, then why all the precautions? If there are other users who should not be editing information, then perhaps, you should consider not making information available to them through tables, forms or queries which are all editable and giving them only access to information in the form of exported queries to excel or text files or in printed Access Reports -- all of which would not allow updating of your db. Just my thoughts on the whole scheme.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
no only me ... but i do have a child under 2 yrs old who likes to play with the laptop .... and i also just want to make sure that i can't mistakenly press something and edit an entry.
I tried the code you put in post above but that didnt work. Did some searching and found the vba code is ".locked" and tried the following as well:
I added an edit cmd button to the continuous view sheet (which adds one to each row that shows) and then added the following code:but that didnt unlock the boxes for editing.Private Sub Command26_Click() Me.Text7.Locked = False Me.Text9.Locked = False Me.Text11.Locked = False Me.Text13.Locked = False End Sub
Does anyone know of a way that I can do this ?
Ok. How did you lock the fields. Did you do it in the properties or with VBA? I would suggest you try doing it with VBA as an on load event for the form.
Then on your command button for the same fieldsHTML Code:me.textboxname.enabled = False
But you will need another command button to lock them after editing.HTML Code:me.textboxname.enabled = True
Also, if you try putting the command buttons in the header, I think that you will then only end up with one. Remember, in a continuous form, it repeats whatever you have on the design form for as many records as you have.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
OK will have a look at that ...
oh and i think i locked them in the properties not in vba
OK tested - the vba code in the onLoad works to lock them when the page loads
and the vba code to unlock them works within the onClick for the edit button
However the problem I have is that there is in fact only FOUR text boxes ... on a single line ... repeated down the page ... so clicking on any one of the edit buttons will open up ALL field within the continuous view form for editing ... which kinda defeats the purpose of what i'm trying to do.
somehow I think i might find that what I want to do is not going to be possible.
the only way for it to work would be to be able to force each new text box to have a unique ID
Last edited by vampyr07au; 04-25-2011 at 09:46 AM.
Ok. More thinking outside the box. Add an after update event to each of the four text boxes. In the after update event put the same code used in the on load event to lock the text boxes.
So, when the form loads, the text boxes are locked. Click on the command button and you can edit any text box. Click on a tab or enter and the after update event fires and re-locks all the text boxes.
Its a workaround that just may work.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Thanks Alan,
It is a kind of workaround. It does work however the only thing wrong with it is that for me to actually edit an entire movie record (read line) I need to click the edit button each time I change the focus to the new text box.
What about a way to use the command button to open a new form with only that lines entries in it .... the form would look just like the search form already created but pre-populate with the relevant entry ?
Create a form that has a record source the query that you developed for the search. Its worth a try. You could have it open as datasheet view. Make your edits and close it.
This also reminds me that if you run a query, you can make edits directly in the datasheet view of the query and it will update your table. Pick your poison.
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
that sounds great thanks alan .... will fix it now .... will probably use the form idea.
brings me to my next question:
I need 2 msg boxes to show up during searching.
first - a msg box when there are no matches to any of the searched criteria.
second - a msg box when nothing at all has been entered into ALL of the boxes in the search form (it cannot be allowed to fire the code if even one of the boxes has something entered into it)
Code I found was:
The problem is that this code does two things - one ... it forces the second msg box to show whenever there is nothing in the title search box - even if both other boxes are filled.]Private Sub Command7_Click() If Nz(Me.Title, "") > "" Then If DCount("*", "search", "[Movie Title] = '" & Me.Title & "'") Then MsgBox ("No movies matching your search. Please refine your search and try again.") Else DoCmd.OpenQuery ("search") ]Else MsgBox "You Must Enter a Title in Order to Search!" Title.SetFocus End If End If
two - when no search results are found it still opens a blank datasheet.
There are 3 search criteria and the no results found needs to run on all 3 or any combination of them.
and the second msg box needs to run only if all 3 boxes are empty.
and when the no results found code runs then NO datasheet is to be opened at all - just an immediate return to the main search menu form
For your if statements, I would consider using something of the order of
AlanHTML Code:if Len(textbox) <1 and len(textbox2) <1 etc. Then Msgbox
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks