admin

How To Use A Variable In A VBA Message Box.

In this post I’m going to show you how to use a variable in a vba message box. This is used commonly to notify the user that an entered item in a combo box is not in the list, also per this post it’s to display the error number or the error description to the […]

Continue Reading

How To Make A VBA Msgbox Yes No

You can use a VBA Msgbox Yes No to get guidance from the user an the control your program’s flow In the following example I am asking the user to confirm whether or not they want to continue. I am storing the answer in the integer variable intAnswer, and then my algorithm processes their answer […]

Continue Reading

VBA Msgbox New Line Example

Here is an example of a vba msgbox with new line   Sub VBAMsgboxNewLine() Dim strText As String ‘Here I am using the enum version of the character feed. ‘strText = “Please try your operation ” & vbCrLf & ” again” ‘Chr(10) and Chr(13) do pretty much the same thing in VBA ‘Chr(10) is a […]

Continue Reading

Here Is An Example Of The VBA Trim Function

The “Trim” function is useful in eliminating the blank spaces in a string normally caused by some data entry error. Why do you want to do this? Well because a sorting error can happen if you are trying to sort ” Dan, “Fred”, and “Ann”. ” Dan” will show up on top before “Ann” because […]

Continue Reading

How To Use The VBA Input Box Cancel Button To Exit Sub

This post will demonstrate how you can use the VBA input box cancel button to exit the sub procedure. When you click the “Cancel” button on the input box, you return a null (blank) value, and knowing this information, you can exit the sub procedure. Here is an example:   Sub VBAInputBoxCancel() Dim strResponse As […]

Continue Reading

How To Search A String With The VBA Instr Function

The VBA Instr Function is very useful for searching a string for a particular piece of text. If for example you want to loop a column or a field in a table of multiple rows, and want to identify prize rows that are 81.51, you would write something like this: Sub VBAInstrFunction() Dim dblTemp As […]

Continue Reading

How To Make An InputBox In VBA

The input box is a great way to retrieve and process input from your user. In the following example we’ll control program flow based on the user’s input in the inputbox. Your user will enter a text value and we will evaluate their answer and send them in the right direction. Sub InputboxVBA() Dim strAnswer […]

Continue Reading

Bringing A 300+ Column Excel File Into Access

Someone asked an interesting question about Excel and Access, so I decided to transcribe it here. “I have an excel file with 300+ columns. I would to split and export them to access as two table and join them. Could you please help me with this.” Thanks in advance, Ma…. Here was my response: “Hi […]

Continue Reading

How To Return A Dollar Value As A Text String

Hi, I received an interesting request, involving VBA and how to return a stock price dollar value in a text character string rather that actual numbers. Like (I=1,M=2,E=0) instead of showing cost price is 12.00 it shows IM.EE. Kind of like code returning a special code. Well, here is my rendition of it. It may […]

Continue Reading

Access Pagination

I have a client who has an underperforming continuous form so I start tinkering around with a model, and created an Access continuous form with pagination abilities. The database is attached. Hopefully it can help you. I will probably be modifying it as needed. [sourcecode language=”vb”] Option Compare Database ‘code 2014 by http://loeblcomservices.com ‘contact: erik@loeblcomservices.com […]

Continue Reading