Object variable or with block variable not set - Access 2013 - ms-access

Please press here to see my gif that could provide a better understanding of my problem.
As you can see above that it's kinda a problem, but I don't know what to do, so I am hoping that some of you could tell me what and how to do with this. It's my first time to see this " Object variable or With block variable not set" problem...
I don't have any code to show you because I was using the default way to make bound textbox and then using a subform with lots of subform. (See the gif for the idea of the layout)
It's in danish language, but I think this should be a common problem as everywhere in the world, so...
It's in access 2013, in case you was asking.
uhm... If there're any questions, please ask right away.

So you have a subform within a subform and you are receiving an error when trying to set the properties of the innermost subform that link it to it's parent form (which I will refer to as the middle subform).
Here's a thought. Try opening the "middle subform" in the designer (ie do not open the main form, just the middle subform from the navigation panel). then set the properties. This has a better chance of working.
Here's some references I used for inspiration, the first of which stresses the fact that the linked "fields" are actually EITHER control names OR field names from the dataset and why it is often best to use control names.
http://www.fmsinc.com/microsoftaccess/forms/subform/master-link-fields.asp
http://access.mvps.org/access/forms/frm0031.htm

Related

MS Access Creating Attribute Tagging Form

I wanted to ask whether or not MS Access can handle an attribute tagging form. Note, "attribute tagging form" was a term I innovated to describe what I had in mind. If you would happen to know the correct term, please let me know.
My Current Method:
On left pane, I have the PDF file in question with file preview. On the right, a Microsoft excel file with the title, file name and other attributes.
The task:
In the left, same PDF. On the right, I need to scroll to the right some distance to mark "Peanuts" and "Soybeans" with "1". Flagging the PDF pertinent to peanuts and soybeans.
The Question:
What I would like to do is create a form in access that would allow me to type out one of the attributes instead of having to scroll back and forth and marking it with a 1. The risk for an error would be too great once there are several dozens attributes to flag.
What I had in mind would be much like stackoverflow's tag function:
Where I can start typing an attribute, and if there is already one existing, it will autocomplete and I can move onto the next one. This will then reflect onto a database (or spreadsheet) with a 1 in the correct column and row.
Side note:
I've done some research on my own into Access' tagging function, but it would appear that it would not work to what I have in mind.
[Resource 1][4]
[Resource 2][5]
[Resource 3][6]
[Resource 4][7]
I think the term you're looking for is "search as you type". You'll find examples here on SO and elsewhere.
Basically, a text box or combobox has a On Dirty event procedure that narrows down a result list as you type the first (or any matching) letters.
In your case, once you've selected a tag, you'd add it to a list, clear the text box, so you can continue with the next tag.

Microsoft Access z-index property

I have a form including listboxes. I'm trying to change order of listboxes. I tried bring front or send back but they are not working in form view. I found z index property for arranging their priority. However, following codes are not working. Is this correct way to do it? Or is there any other way with or without codes to do this?
Me.Controls.SetChildIndex (Me.List0 , Me.List1)
Thanks for any help.
Without using code:
You can change the z-order by right-clicking any control and selecting "Position" then selecting either "Bring to Front" or "Send to Back."
Unfortunately, Access does not support the ZOrder method for manipulation using code. Microsoft Forms does support the ZOrder method which can get confusing when it comes up on Access Help.
As I reread your question, I wonder if you're talking about tab order. If so, right-click and bring up "Properties," select the "Other" tab, then adjust the "Tab Index" property. Also, make sure that the "Tab Stop" property immediately beneath is set to "Yes." In code you would use FormName.ControlName.TabIndex=0 to set a control to the first tab position.
Hope this helps!
Reference: Personal experience (and hours of frustration)
docmd.RunCommand acCmdDesignView
forms("form1").Controls("text0").inselection=true
docmd.runcommand acCmdSendToBack '(or docmd.runcommand acCmdBringToFront)
docmd.RunCommand acCmdFormView
Also, ZOrder is still not supported by Access 2016. As such, I have not yet learned a way to write a single line of code that puts a control in between two others, I just send the middle to back and then the back to back, and expand this to however many controls have to overlap.
And last, even though you use the VBA for ZOrder, your English does ambiguously sound like forms("form1").Controls("text0").TabIndex=34, which as Olek suggested, is also quite simple.
I did this on one Access form: The control I wanted on top I just cut and pasted it back to the form, then moved it over the one I wanted to cover. In this case, it was a text box (bound), almost the same size as a combo box (unbound); only the dropdown of the combo extended a bit to the right of the text box, so when the form was loaded the text box looked like a combo box. The user clicked the dropdown and made a choice and the record(s) pulled up were reflected in the text box.

Does Microsoft Access allow this function?

Does microsft office access have this function when i select the row from the subform,
the selected data from EmpName, ComputerName & ProductName will automatically fill into my 2 textbox at the top right and the product Name will be another combobox to select product.
Another thing is, Is it possible to do CRUD upon selection in subform?
what kind of tag should i goggle for to answer my question? I tried a lot of different tags aldy but none answers my question.
The short answer is yes. ;) You can do all those things. I well remember the day I realized that I could do anything in MS Access. (now be kind this was the first experience I had in programming)
You can reference Parent controls from subforms with this convention Me.Parent.control
For example if the Parent form has a text box named txtEmployeeId then on the Click event of a text box in the sub form you could have this code.
Me.Parent.txtEmployeeID = Me.txtEmployeeID
You can quickly extend this code to do whatever you need ie.
Me.Parent.txtComputerName = Me.ComputerName
Me.Parent.cboProductName = Me.ProductName
CRUD is a statement used in web development which seems to be where you are coming from. Access is CRUD in many ways (unless you start getting complicated) In the example above, once you navigate off the parent record with the record selector or close the form, the record is saved without any code being written. Once you start playing around with unbound controls then it becomes necessary to write code to save your work.

Access 2010 - What Control Name do I use to Requery this Subform?

I am now learning MS Access and I have run into a problem. I have found similar questions but after trying them I still can't figure this out.
I have added a button on a form that updates a table behind a subform and I now need that subform to display the new data. Can anyone tell me what to use as the Control Name or if I'm even on the right track to get what I want?
My main form is "EnterEmployeeSales" and my subform is "RetailSalesSubform".
Here are some screen shots of what I'm trying to do:
EDIT: I figured it out. I was making it TOO COMPLICATED!
I kept trying to enter stuff like "Forms!Yadda!Yadda" but all I needed to enter was the subform control's name only into the Requery "Control Name" field on my screen shot above. Imagine that! Here is a screenshot on how to determine the subform control's name (for other loser noobs like me):
There are two parts to a subform, the subform control and the form contained. It is important to use the name of the subform control to requery, not the name of the form contained. So:
Forms!MyMainForm!MySubformControlName.Form.Requery
Or when writing code in the form module:
Me.MySubformControlName.Form.Requery
An advatage of using Me in the form module is that intellisense will give you the name of the subform control.
More information: http://access.mvps.org/access/forms/frm0031.htm
The macro is one way to do it. VBA can also do this. In your case in the "onclick" event you could put the code:
Docmd.Requery "ServiceSalesSubform"
It does the same thing but sometimes it is nice to have everyting in VBA code. When there is a mix of code and macros it can get confusing to tell what is happening and when.

Access 97 VBA writing code

I found that I can write code just by typing everything or activate element, then click for example OnClick property and write code to between the sub-end sub lines.
One person I met said that one has always use mouse and select the property in which you want to write the code, as it might write something else to some files such that the code won't work.
Is this correct or are those two ways to write code equally good? I'm using Access 97.
The short answer is you CAN do it that way. But it doesn't mean you SHOULD.
With a little experimentation I've found that you can type in event subs directly in the code window, and their creation will be reflected in the properties window. This might not have always been the case in older versions of MS Access.
You can also create them by selecting the Control in the code window's top left pull down, and then selecting the event in the top right pull down.
Why would I choose to use the Code Builder (or at least the second option I provided). Because it prevents you from making mistakes. Both in the name of the control/event and in accidentally creating duplicate Subs. Both of which could be frustrating when debugging your application - how long could you spend looking for a bug because you added an extra "S" to an element name by accident. If you follow through from the properties window, you are guaranteed to be working on the right Sub and that it will be spelled correctly.
Note: I've also found that you can delete the entry in the properties window, but it leaves the code behind in the code window. So to make sure it is really gone, you do have to go into the code window and delete the Sub there.
That's not to say that I never do anything directly in the Code window like that - if I've renamed a control, I'll often update the name in the code window. But then I'll go back through the properties window to verify that I've re-connected the subs properly.
"Look, I'm running with scissors!"