Complie Error: Method or Data Member not found, but it does exist - ms-access

Having a strange problem in vba access. I have a text control control called txtUserName on a form and am trying to get the contents which is all but child's play. When I try to run or complie, I get the Method or Data Member not found error. However, when I type me. Intellisense shows txtUserName. I have gone as far as copying and pasting the name from the control's properties and still get the error. What am I missing? I am completely perplexed.
Thanks in advance
Don

In this case, I was just building a SQL string. I did find the problem, there was a bad control reference, however, it was not the one that was highlighted (highlighted was the first value in an insert into string and it was actually the 3rd value)

Related

SSIS package save error - an invalid character was found in text content (msxml6.dll)

I am tearing my hair out with this one. I have a large SSIS package (2.5Mb) that includes 3 ConnectionManagers each of which have an expression attached for dynamic assignment of the ConnectionString dependent upon the value of a user variable - CountryCode. I got this to work for one value of CountryCode (="AUS") but, when I change the value to "USA" and try to save it immediately afterwards, I get the error above ("an invalid character was found in text content (msxml6.dll)") but with no line number or useful further info that might help me tie down the problem. I am guessing that the failure has nothing to do with the "USA" text that I simply typed over the "AUS" text but is linked to the assignment of the ConnectionString associated with "USA". Would that be a fair assumption? I have examined the ConnectionSTring with a fine tooth comb but can't see a problem with it. Any suggestions would be welcomed, thanks.

There was an error compiling this function. Access 2013 Calculated field issue

I have a table with a field which is of a calculated type and contains the following expression:
IIf(IsNull([OrderValue]),[TotalPhaseLabourCost]-[DefaultOrderValue],[TotalPhaseLabourCost]-[OrderValue])
For some reason when I go to open the table in any view it throws the error:
"There was an error compiling this function.
The Visual Basic module contains a syntax error.
Check the code, and then recompile it."
However, I have this database currently open on two laptops, one works fine and the other has this issue. I have checked both db's refs and they also match up.
That's a bit vague, so I can only make guesses.
Try to compile the code as the error message says.
check if you have any function with the same name as your field
Try replacing IIf(IsNull([OrderValue]), by IIf([OrderValue] is Null,
You probably miss the leading equal sign:
=IIf(IsNull([OrderValue]),[TotalPhaseLabourCost]-[DefaultOrderValue],[TotalPhaseLabourCost]-[OrderValue])
Or you could use:
=[TotalPhaseLabourCost]-Nz([OrderValue],[DefaultOrderValue])
For me there was some problem with some fields (it showed an error message #NAME? in some of the fields (date, number) in the 'new' record).
For me it worked to close the table, right-click it and open in design view.
For each of the fields with problems, I choose the data type (that was already shown) again from the drop down menu (so, same data type!).
Save.
Then it didn't give the error messages anymore.

Type conversion error in VB when accessing a HTML table

I have a HTML table where I am allowing dynamic adding/deleting rows (that contain text-input's in the cells) using some JavaScript. I am not using ASP.NET TextBox controls, just traditional HTML, as I don't think rows containing ASP.NET controls can be added/deleted without a postback.
When the user clicks an ASP:Button, I am using VB to loop through the table rows in server-code, and ultimately use LINQ to write to a database. I have "Imports System.Web.UI.HtmlControls" in the file.
The code where I am getting problems is:
Dim name As HtmlInputText
name = row.Cells(0).Controls(0)
The error is: "Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.HtmlControls.HtmlInputText'." On the 2nd line above.
There is only one input control in each cell, so I am assuming I can use "Controls(0)" to access it. I have read solutions that use "FindControl", but I don't think this works with standard HTML "inputs", but also, as the rows are dynamically added/deleted, it's near-impossible to know the "ID" to search for.
Any ideas? Cheers.
Figured out the problem. Just needed to add runat="server" to the input tags. Thanks every one for the replies.

NotInList script

I am trying to use Access and VBA to create a DB to store my library. I already posted a question and got a useful answer but I am still failing with the basics, so, after having checked this tutorial link I am starting from scratch and doing it in smaller steps (i.e. asking more basic questions...).
I have the following DB structure and relationship details:
DB structure and relationship details http://img195.imageshack.us/img195/8184/relationshipdetails.png
Using the Access AutoForm:Columnar wizard I created a Form based on the Table Libri, then I changed the field "Stanza" into a ComboBox, I entered the RowSource as follows:
ComboBox http://img560.imageshack.us/img560/160/comboboxdata.png
Then in the Event tab I selected the ... controls in the NotInList and in the VBA I entered the following code:
VBA code http://img689.imageshack.us/img689/1416/notinlistcode.png
Saved everithing, but when I open the Form Libri and try to enter a value in the ComboBox I get the following error message:
Error message http://img41.imageshack.us/img41/8937/errormsgt.png
All my tables are empty (no records).
So the VBA code seems not to be considered/executed at all, what am I doing wrong or missing?
Ok, I was completely blind.
The error is the option: "Limit to list" that I set to "NO" and instead, the NotInList event is only filred if such option is set to "yes".
I find this conter-intuitive, but at least now I know.
Sorry for bothering other. hope this is helpful some other newbe like me.

Use a value from a combo/text box in a file path string

I have a form that I intend to allow users to browse powerpoint presentations through, because there are a lot of different briefs for metrics, which is what I use this database for. So, I already know how to set up everything, just got one little hang up.
If I place a combo box on the form to select from a list of different presentation, can I use that in the file path string (that I have to use to pull the ppt into theobject frame in access.
example:
"C:\Users\Justin\Desktop\" & cmbTitle & ".ppt"
I tried it and it gives me the error message variable not defined. I never defined a control before on in these things, would it be as a string?
I realize that the exact file path much match the entered value. Access 2000-2003/XP
Thanks as always guys!
You need to refer to the field as Me.cmbTitle. As it is written, it looks like you're calling the variable cmbTitle which doesn't exist.
Is the value of cmbTitle some ID/Integer field or is it the actual string value? You may want to use the immediate window to check this. Also, make sure the value of cmbTitle doesn't have any backslashes or spaces (That may require quotes?).
I'm somewhat confused as to what you're trying to do. I will write my answer assuming:
you have a form in an Access database.
on that form is combo box that lists the PowerPoint presentations your users are working with.
the bound column of the combo box lists the filename (without path) of each PPT file.
when the user selects a filename from the combo box, you want to display it in an unbound OLE object frame.
The code for that, assuming the list of PPT files is called cmbTitle, would be in the combo box's AfterUpdate event and would look like this:
Private Sub cmbTitle_AfterUpdate()
Dim strPresentation As String
If IsNull(Me!cmbTitle) Then Exit Sub
strPresentation = "C:\Users\Justin\Desktop\" & Me!cmbTitle & ".ppt"
Me!olePPT.SourceDoc = strPresentation
End Sub
Now, I can't get a test unbound OLE object frame to work with this, but it seems to me to be the right way to do it.
My suspicion is that you're either attempting to set the wrong property, or you've defined your OLE frame wrongly, but I can't offer any more advice on that without knowing more about what you're actually attempting to do, and exactly what line of code is causing the error.