Modules & VBA :: With Block Not Set Error
Jun 6, 2014
I have the below code that seemed to work until I tried to add the Loop to it. Now, every time it gets to the piece of the loop with the words Cells.Find, I get an error stating "With Block or Variable not set". I don't understand what the problem is. There is no "With Block" and the variable is set. How can I get this to work?
Code:
Function ClearColumns(xlWS As Object, ColumnRangeToClear As String)
xlWS.Range(ColumnRangeToClear).ClearContents
End Function
Public Function SendTQ2XLWbSheet(strTQName As String, strSheetName As String, Col As Integer, strFilePath As String, FirstCellStr As String)
[Code] .....
View Replies
ADVERTISEMENT
Mar 13, 2014
I have some code that will run if I am populating an empty table(no duplication's possible) but now I am trying to create a Sub to check for existence of a record and handling it going forward.
Anyways the big picture is looping through a text file and placing data where it needs to go. The code follows including some comments point to the issue.
Code:
Sub PutinNewTag(TableIn As String, Tagtype As String, textline As String)
Dim strSQL As String
Dim NameIn As String
Dim TagName As String
Dim Db As DAO.Database
Dim rstin As DAO.Recordset
[Code] ....
View 8 Replies
View Related
Jul 8, 2013
Error 91 - Object variable or With block variable not set
I am getting this error telling me that an object variable is not set.
I know which variable it is but when I step through the debugger it sets the variable and all is fine? Issue is that public variable of a class is not getting set when the VBA Editor is not open?
View 14 Replies
View Related
Nov 21, 2012
What is "row level locking"?
How can I get around the "encrypting with a block cipher is incompatible with row level locking" error.
I've never had this error before and I do not know what I did to cause it.
View 5 Replies
View Related
Apr 16, 2013
I am creating a 2 level report to confirm an order. Main report already created, runs successfully called as subform/subreport under "OrderDetails" form. Linked to master using Order.ID. There are two versions of the confirmation report that have different layouts for different program types.
The hangup comes when I try to add a "Class Dates" subreport. It lists dates of individual classes and Skip dates. I have created the subreport as "srClassDates". When I add it to the main report, it lists the records. However, when I try to link it to the Main report, an error message box appears with the "object variable or With block variable not set".
I have tried rebuilding both the main and subreports, rebuilt the query, have not found anything that changes the result.
Linker has been working successfully on other subforms. Report with groupings works fine, but I need data from 2 tables both linked to order.id.
View 2 Replies
View Related
Dec 5, 2014
I have the following dataset in a table called NR_PVO_120. How do i pick out a number (which can change but let's say, 6) of UNIQUE OtherIDs without excluding any OtherIDs under any fax numbers?
So, if you pick OtherID from Row7 you then also must pick OtherIDs from rows 8 and 9 because they have the same fax number. Basically, once you pick an OtherID you're then obligated to pick all OtherIDs that have the same fax number as the one you picked.
If the number requested (6 for this example) isn't possible then "the closest number possible but not exceeding" would be the rule.
For example, if you take OtherIDs from rows 1-10 you will get 6 unique OtherIDs but row 10 shares a fax with rows 11 and 12. You either need to take all 3 (but that will raise the unique count to 8, which isn't acceptable) or skip this OtherID and find one with a fax that has no other OtherIDs and that isn't on the result set already. My result of 6 UNIQUE OtherIDs will need to contain ALL OtherIDs under any fax the existing OtherIDs are connected to.
So one solution is to take rows 1-6, 26. Another is to take rows 1-4,10-14.
There will be many possibilities (the real dataset has tens of thousands of rows and the number of people requested will be around 10K), as long all OtherIDs connected to all faxes on the result set are part of the requested number (6 in this case) any combination would do.
A few notes.
1.Getting as close as possible to the requested number is a requirement.
2.Some OtherIDs will have a blank fax, they should only be included as a last resort (not enough OtherIDs for the requested number).
my table (NR_PVO_120)
Row OtherID Fax
1 11098554 2063504752
2 56200936 2080906666
3 11098554 7182160901
4 25138850 7182160901
5 56148974 7182232046
6 56530104 7182234134
[code]....
A few sample outputs
one solution is taking rows 1-6 and 26.
OtherID
11098554
56200936
25138850
56148974
56530104
56148975
Another solution is taking rows 1-4 and 10-14.
OtherID
11098554
56200936
25138850
56024315
56115247
56148974
This is for a fax campaign, we need to make sure no fax number is faxed twice, that all people connected to that fax number are contacted under one fax sent.
View 12 Replies
View Related
Oct 3, 2014
This code runs fine the FIRST time, however trows up a message the SECOND time it is run.
The error is on the line ".Range"
I am trying to sort records which have been exported to Excel.
Dim LR As Integer
LR = 5
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wbRef = xlApp.Workbooks.Add
With wbRef
wbRef.Activate
.Worksheets("Sheet1").Activate
With ActiveSheet
.Range("A2", .Cells(LR, "O").End(xlUp)).Sort Key1:=.Range("C2"), Order1:=xlAscending, Header:=xlYes
End With
end With
View 3 Replies
View Related
Jul 13, 2005
Hi-
I am a self taught beginner in Access applications, so excuse my lack of expertise and terminology. From reading through this forum, I realize how far I have to go. I am not a techy by any means.
My question: I have a database that keeps track of the delinquent taxes for our Town. One of the reports is set up from 2 queries, then 2 related tables (beginning balances and payments made). The query calculates the balance of each account based on the beginning balance minus the payments made, and returns a report which shows each account balance, and then another query returns a report showing the total balance of all the accounts due for the date the report is generated.
I am wondering if there is a way to generate the balances due on a previous date. For example today is July 13, and I want to know what the balances were on July 1. Both tables have a date field- beginning balance has a start date, and the payments table has the dates of any payments.
Thanks in advance for any advice
View 6 Replies
View Related
Oct 18, 2005
What is the condition or how should I write a VB code to block the command go to last empty record? I have a form which has three buttons : Go to Previous Record, Go to Next Record and Add New Record. If I add a new record, and I press "Go to Next Record" well, it goes to the next empty record this means it does the same job as the "Go to Add New Record" button. How can I stop this happen?
Thanks,
Le
View 2 Replies
View Related
Mar 13, 2006
I hope someone can help me. I have a report that prints out with the customers social security number on it. I need to change it so that only the last four digits of the SSN show, so it would like something like this XXX-XX-1234. I still want it to keep the full SSN in my Table though so we can search for the customers info with the SSN.
Is there a way that I can change it on the report only and not mess up any other forms that I have it on? Any help would be awesome!
View 4 Replies
View Related
Oct 20, 2005
I have a form for all my clients, and currently there's a separate field for each part of the address. This does not make it easy to cut and paste an entire address block. I therefore created an unbound text box with the control source as:
=[FMT-NAME] & Chr(13) & Chr(10) & [Pref1] & Chr(13) & Chr(10) & [Pref2] & Chr(13) & Chr(10) & [PrefStrt] & Chr(13) & Chr(10) & [PrefCity] & ", " & [PrefState] & " " & [PrefZip]
This works ok, but if someone doesn't have anything in the fields [Pref1] or [Pref2] it leaves blank lines. Is there a way to code it so that I can have a complete address block? Thank you.
View 4 Replies
View Related
Sep 25, 2006
I have a form displayed as data sheet, how can I block the column so that the final user will not modify the width of the columns?
M
View 1 Replies
View Related
Oct 12, 2004
I need to export a table as a text file but using the outputto or transfer text options do not produce the file format I want. If I export the file as Excel and then save it as text it's OK so I copied the following code to automate the procedure but get an error 'Object variable or With block variable not set.
Can anyone help?
Function Export()
Dim objExcel As Excel.Application
DoCmd.OutputTo acOutputTable, "MyTable", acFormatXLS, _
"c:dataMyExcelFile.xls", False
Set objExcel = Excel.Application
objExcel.ActiveWorkbook.SaveAs Filename:= _
"C:dataMyTextFile.txt", FileFormat:=xlText, _
CreateBackup:=False
objExcel.Quit
Set objExcel = Nothing
End Function
View 4 Replies
View Related
Jul 1, 2013
I Have a table votes where a user is able to vote for a specific campaign, when the user votes his username and the date and time is logged in the table votes.
After the user voted he is logged out, then displaying the login form for the next user.
At the login form I want to check if a user already voted and if so he should not be able to login again. How can you do this ?
View 3 Replies
View Related
Sep 1, 2014
Code:
Private Sub Consolidate_Click()
Dim temp As Variant
Excel.Application.Visible = True
temp = Dir(CurrentProject.Path & "Inputs")
Do While temp <> vbNullString
[Code] ....
From the second iteration its not picking the error.
View 5 Replies
View Related
Jun 10, 2005
Hi all
Please help. one of my table is confidential data and I don't want people from opening from the table. Can I block people from opening but people who has password can only access this information.
eg. please see my enclosed attachment file and the table is cost. I don;t want people to see the data by click the table filename.
Hope someone can help me.
View 1 Replies
View Related
Feb 25, 2006
I am developing one software in access 2000. Now where i stuck up is ... Customer is asking for " process flow chart" (steps in block diagram). The requirement is as below..
For a pen there are below operations
1. moulding
2. cleaning
3. polishing
4.assembly
Now these flow of operation is to be presented in block diagram. Please suggest me how do I do this in accesss? (in form or report)...
View 3 Replies
View Related
Nov 8, 2004
I have a table which has a primary key of 3 fields. Each individual fields is defined with duplicates OK but I want to block a record being added where the primary key value exists already. How can this be done - the way I have set up the database Access does not automatically stop this as I thought it might. Do I need somw vb also??
View 14 Replies
View Related
Apr 27, 2006
Hi, in some application I have made using a switchboard after starting up, I saw that when the user holds the shift button, this switchboard does not show up automatically. How can i fix it that the user cannot interfere holding this button?
View 2 Replies
View Related
Sep 23, 2005
The Return of the dreaded mousewheel! I have used the fab Search option on this topic, but I feel I have some requirements that prohibit me using some of the options available. I need to allow its use for navigation of the mainform, but totally block it on the subforms, but with lots of conditions!
The database in question is NOT mine, and it's already built. If it were one of mine, I'd simply block the darn thing entirely or adopt some of the example databases I found (ghudsons was the kind of data verification I can dig, and a few in A97 format were good too).
I have to cater for workmates that are strangly fussy, rather lazy and totally unappreciative of order. Who would have though enforcing uniform entry of dates from 20 different ways (I counted) to one way, was such a contentious issue? OR, a BAD idea? Sigh.
As a result, I cannot be seen to have done ANYTHING to its function. So, I cannot have:
*Any form of "save" each record or blocks or anything like that
*Any form of validation boxes or message boxes popping up
*No dlls (if possible)
*In a nutshell, no extra effort - Type 'n' go - it has to be a secret
*And, I can't block the mousewheel from scrolling through personnel in the mainform.
I have to eliminate the RAMPANT creation of duplicate subentries (like, you're still on the one record in the main form, but if you're not paying attention and wheel in the subform, you flick over to the new row and type, and POW).
Am I dreaming? Is there some easy solution in form setup that I'm overlooking? (the problems of self-education, you are often unaware of some of the simplest little options). I aplogize if this solution has been presented before on the board, but it is likely I didn't not understand what I saw properly, or I felt it wasn't quite what I wanted. Thanks very much.
View 1 Replies
View Related
Dec 4, 2012
My database contains business names and addresses in separate fields (name, address, city, zip code, state, country)
Now I have to build the address block for labels.
If there were just US addresses it would be easy but a business can be located in any country with the problem being
that countries require the block to be build in a specific way (order of city, state, zip code).
In some cases a particular section has to be upper case as well.
Of course I can build it manually in a memo field but the with chance of something easily going wrong I like to automate it.
It does mean the same info will be stored twice which is basically a no no.
I'm thinking of making a separate table with records for all possible layouts and use those as a source for a memo field in the business table. However I can't oversee if that would work alright or not.
Or should there be a way to generate the blocks on the fly?
View 9 Replies
View Related
Apr 24, 2015
Is there a way to securely block the access of user to tables/queries, else in Microsoft Access?
View 6 Replies
View Related
Aug 21, 2014
I have a form that has four textboxes, date dropdown box and a date box. I am trying to get the form to do the following: Block user from writing in the textboxes if they have not selected a date in the date box.
Get the datebox to look at the behide screens records to see if there has already been a documented date (duplicate date) and inform the user that this date has already been used. Then auto them to the date dropdown.
View 2 Replies
View Related
Jul 17, 2012
If I have an MS Access frontend that connects to an MS Access backend, is there a way to hide/permission block the pathway to the backend's folder but still allow access via the frontend db?
Right now I can't dedicate a server to a more "secure" form of DB or anything like that so I'm stuck with MS Access for now. I just don't want someone looking at, say, a link table path and then navigating to that folder and getting access to backend information.
View 14 Replies
View Related
Aug 25, 2006
OK, it was bound to happen eventually...
New user of Access 2003 has inadvertently clicked "yes" to "Block Unsafe Expressions" and now can't even click a simple command button to print a report. :confused: Db has not a single macro, nothing fancy, mostly wizard code.
Other folks logging onto that PC can still function fine.
I'm assuming it has set him into Sandbox mode & we need to back out of that setting. I've searched a ton of GHudson posts on this forum, read everything Jeff Conrad links to, looked at the following MS articles.
Understand how to enable or how to disable Sandbox mode
http://support.microsoft.com/default.aspx?kbid=294698
Enable or disable sandbox mode
http://office.microsoft.com/en-us/assistance/HP010504321033.aspx
One article issues a dire warning about dangers of setting registry keys and the other doesn't seem to fix the problem at all. We're in a severely locked down environment and cannot download anything or change system settings -heck, can't even run ScanDisk anymore.
Will re-installing Access solve this, or does anyone know of a solution that will work given our limitations?
Any help is appreciated!
View 5 Replies
View Related
Apr 15, 2015
Runtime error '91'
Running Access 2010.
I have two reports running off of the same crosstab query. I copied one report to make the second report, then modified the second report to change the background of column fields satisfying certain conditions. These lines of code were added to the Detail_Format section, in color below. The report with the extra code lines does not error--the original report errors.
Code:
Option Compare Database
' Constant for maximum number of columns EmployeeSales query would
' create plus 1 for a Totals column. Here, you have 9 employees.
Const conTotalColumns = 11
[Code] .....
If I say OK (rather than debug) after the error message, I can then click the button for the report again and it runs without complaint. And, as I said, the report with the added code never errors.
View 4 Replies
View Related