Hide new row on form in Access - ms-access

My project has a form with tabs, each tab displaying data from a different table based on the current record (I will call the main form's record the client) selected in the main form. If there is data present in the child table associated with that client, then show the data. If there isn't, I have a text field in my form header to say there are no records, with a link to open up a form for adding data to said child table. The form header also contains column headers for my continuous forms.
Now, if on the child form, I have Allow Additions turned off, then if the child table is empty for that client, it shows no data and the form_current or form_load methods do not seem to run, which is where I had code for hiding the column headers and unhiding my "No records" status/header text box, and vice-versa if there is data in the child form. If I turn Allow Additions on, then my code runs to hide the columns and show the status text box, but when there is data available in the table it shows the "new row" at the end of my results. I do not want the new row there.
So I can either turn on Allow Additions, have my code work, and it shows an extra new row, or I can turn off Allow Additions, my code breaks, but I don't have the extra new.
I tried to do this:
If Me.NewRecord Then
Me.field1.Visible = False
End If
but this produces undesired results; it doesn't hide the new row until I select it, then it hides all fields. I know that is how it should work, its just not the result I want .

Related

Remove empty column from access form

So I'm new to access and making some modifications to some existing forms. I had to delete some columns from forms that are no longer used, which I did by removing them from the select query. I am however left with line delimiters for the columns that no longer exist, as you can see here.
edit: This is a subform. The form layout is to enter a project and type, and depending on what you enter it will display several different tabs, and the pictured table is displayed under one of the tabs.

(msaccess) Sync user scrolling across multiple pages/tabs/datasheets?

I have a form which contains multiple datasheet subforms, sorted into different pages of a tab control.
Each subform datasheet is based on an entirely different query, although in my case all subforms will always contain the exact same number of records as each other.
Question: Is it possible to programmatically capture user scrolling input (via keyboard, mousewheel, navigation buttons, or any combination thereof) and pass that information across subforms, so that, regardless of what the user does, whenever they switch pages/tabs, the same record number will always appear in row position one on every page/tab?
E.g. I have three subforms, each located with its own page control, and each underlying recordset has exactly 1000 records. A user scrolls down so that record # 575 shows in the first row of that page's subform. The user never actually selects any record, merely scrolls using mouse or keybpoard.
Is it possible to guarantee, that if the user switches to a different page/tab, that record number 575 of the corresponding recordset will show in the first row of the new page's datasheet?
There is no event to catch the scrolling itself, but you can control that the same current row id is visible in all subforms.
Full code and explanation including a working demo can be found and downloaded here:
Synchronizing Multiple Subforms in Access

Hyperlink box (txtbox) on Access Form won't allow drop

I have a MS Access form that is bound to a query in the database. I added a textbox and added a row source to a Hyperlink datafield in the query. When I open the form, it won't allow me to drop a file into the textbox.
Here's the deal. When I follow this EXACT same process on a new form, it works perfectly. That is, I open a blank form and I bind the form to some new query, let's say qryNewIdeas. Then on the blank form i add a textbox, let's say Text0. Then, when I select Text0, I go to the data tab - row source and choose the dropdown arrow to select the hyperlink field, lets say NewIdeasAddress. I click SAVE and open the form. It works PERFECTLY.
BUT, when I repeat this on an existing form (the one where I need the thing to actually work), it does nothing. It adds and changes the textbox to a hyperlink box (I note this because of the blue underlined word that appears in the box). But it won't allow me to drop files to this location.
I tried commenting out ALL of my VBA code to try to make sure that something wasn't hindering it (say in an OnLoad event) AND I've checked all of the form and control box properties and they seem to be the same in both the existing form and the test form.
I can't determine why it works on one form and not the other; Solution needed.
If you have access to "the data tab - row source ..", you are in design view.
When you later open the form, you are in form view, a completely different animal which specifically prohibits design changes.
It sounds like you will have to rethink your concept.

Rearranging the tab order of fields in a sub form in data sheet view

This is an ongoing problem, and I'm hoping there is just a property that I'm missing.
Scenario: I have a form that contains subforms. The Default View property for the subforms is set to Datasheet. (The main form is set to Single Form). Due to changes in what I'm tracking, I want to include another field that wasn't part of the original record source. So, I changed the record source (a query) and added the field to the subform. The new field is added to the end of the Datasheet view by default.
Here is the problem - when I drag the column to a new location on the subform (in Form view or Layout view), it does not stay put. I have made the change using Form view and Layout view, and I've changed the Tab Index property for the field to the proper number.  The new position never stays on the first, or second, sometimes third and fourth try. I have tried saving in Form view, Layout view and Design view, but I always have to drag the column back to the new position and try to save again . This goes on until Access actually saves the change. drag, save, didn't take; drag, save, didn't take; drag...
What I'd like to know is this - how do I rearrange columns on a form that is set to "Datasheet" for the Default View property, and make it stick the first time?
Thanks for any suggestions - I must be missing something....
This is a known "limitation" of datasheets. Some want the columns fit or preset, other sticky, some either as selected by the user.
To control the order of the columns, adjust the ColumnOrder property of the displayed controls.

How to make child form refresh when master is clicked?

I have two tables, WorkItem and Status. They are related as follows: Status.WorkItemID is the foreign key mapped to the primary key WorkItem.ID. I want to set up a form so that there are datasheets for WorkItem and Status, and when a row in WorkItem is clicked, Status is refreshed with the related rows.
I tried doing this by opening the WorkItem table, and then creating a form based on it. While this did create a form where going through the WorkItem records refreshes Status, WorkItem is represented as a set of text boxes rather than a datasheet, and I can't figure out how to change those text boxes to datasheets.
I also tried dragging WorkItem and Status tables onto a blank form, and then setting the properties for the form as follows:
Record Source is set to "WorkItem"
In the Table.Status control, Link Master Fields is set to "ID" and Link Child Fields is set to "WorkItemID"
This didn't link the two forms, though; all the rows in Status are listed, and when I click from one WorkItem row to another, nothing happens in the Status datasheet.
What am I missing?
Did you open the form in Design View and set the Default View property to "Datasheet"? When you open the Properties dialog box and click on the "Format" tab, it should be the second property from the top of the list.