Posts

Showing posts with the label MS Access

How to backup Access file using VBA code and zip it

Image
Hi, it's been a lot of time since last post. i have found this nice access file that is very useful if you have an access database file that is separated from the original main file, it's mean like this scenario: you have the main program that is an access file (*.mdb or *.mde) (like main.mde) that contains all the forms and the reports and the modules.. and you have a separate file mdb or mde also (like data.mdb) that contains the tables and the data.. in this way you can't make a backup of the data file using backup database tool located in the access software... you need to backup the data.mdb file... so how you do this!!! using the modules located in this file " backup demo " you can easily do this.. just click the button and the program will check if you have installed Winzip... if you did it will backup the file to a temporary folder and zip it than save it in the location you want.. else it will just copy the file to the location you...

VBA code: how to insert a value in a combo box that is not in list?!!

Image
hi. every beginners access developers have a problem when they want to insert a new value in a combo box. that is created by "lookup wizard" or it's a foreign key and contain bound column that is generally number (hidden one) and a second column that usually a text (visible one). so when u try to insert a new value. you will got this horrible message: do you remember itt??!! now this is your solution: 1- go to the properties of the combobox in design view.. 2- click on the events tab.. 3- and double click On Not in List. 4- you will go to the VB window. 5- insert this code: Dim strSQL As String Dim i As Integer Dim Msg As String 'Exit this sub if the combo box is cleared If NewData = "" Then Exit Sub 'msg will apppear to the user asking him what he want to do? 'change the text if you want. Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr Msg = Msg & "Do you want to add i...