Search results

  1. A

    How to visualize bottles in a virtual storage rack

    I have a database of all my wine. Just a simple one, where I can add/delete/update the information. As I'm expanding the wine rack, I would like to keep track of where it is, so it is easy to find, when being used. I have attached a small example of what I'm trying to achieve. The example...
  2. A

    Runtime 3075 syntax error (comma) in query expression

    I have written a simple piece of code using DLookup to find a value in a query, but keeps getting above error. I have used it with text in the passed (slightly different code) where it worked fine. Code is used in a After update expression in a combobox: Me.txtUllageVolume = Nz(DLookup("M3"...
  3. A

    Use of DLookUp with interpolation???

    In the attached sample DB I have a table, with "Ullage" and "M3" fields. If I on a form use below code on textboxes, I can get the volume in M3, if I type in the Ullage. Example code: Me.txtVolumeM3 = Nz(DLookup("M3", "tblUllage", "Ullage='" & Me.txtUllage & "'")) The issue I have is for each...
  4. A

    Aligning borders to text boxes in a report

    Attached is a database, I previously found on a forum a few years ago, which can align the borders of text boxes on a report, to they all have the same height, depending of amount of text inside. As such it works fine. But there is a flaw. In the first row of text boxes shown on the report...
  5. A

    Text box Control Source

    I'm trying to create an Expression as Control Source for a Text Box. An example which can be found is: =DLookup("[ProductName]", "Products", "[ProductID] =" & Forms![Order Details]!ProductID) In above example the criteria is based on [ProductID] on a form. Is it possible to change it, so...
  6. A

    Validate input in textbox

    I have a textbox where I need an afterupdate event, which should check that input is 3 letters followed by 3 numbers. The total is 6 characters, but always 3 letters + 3 numbers. If condition not met, a msgbox will be shown, for the user to input correctly, before being able to continue. Can...
  7. A

    Checkbox behavior

    I have 3 check boxes, where at least 1 have to be "true". I can't figure out how to ensure that if 2 of the check boxes already are "false", then the last one can't be changed. Lets say that 'chkNumber1' and 'chkNumber2' are 'false'. Then 'chkNumber3', which is 'true', should stay locked. If I...
  8. A

    How do I test for various combinations of data, before updating a record?

    I’m currently working on a POB (Persons On Board) database, and have a problem when needing to do a check if a cabin/bed is occupied or no. A little information on how it works: When planning crew on board an oil rig, you can choose from e.g. 60 cabins, with e.g. 2 beds in each cabin. Cabins...
  9. A

    Problem with a SELECT ... FROM ... WHERE statement

    When running below code, it stops after the 'SELECT' statement. Private Sub cmdUpdate_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Dim answer As String Dim answer2 As String If IsNull(Me.txtFullName.Value) Or Me.txtFullName = "" Then answer2 = MsgBox("Please choose someone to...
  10. A

    Continous form - Scrolling in detail very slow

    I have a continous form, where the Detail section contains various control, which the user can fill out, and then update a table, by click of a button. The problem is that when scolling the Detail section up and down, it goes extremely slow (i.e. I'm not scrolling through records, it's just the...
  11. A

    How to select the last characters in a text box

    I was using below expression to combine three text boxes, into a third text box. =[txtPathProcedures]+[txtProcNumber]+Right([txtURLPath];4) The txtPathProcedures is a textbox containing the path for some files. The txtProcNumber is containing the file name. And finally txtURLPath is containing...
  12. A

    Printing linked files (word, pdf etc)

    In order to open files with a cmd button, I use below code: The module: Option Compare Database Option Explicit Public Const SW_HIDE = 0 Public Const SW_NORMAL = 1 Public Const SW_SHOWNORMAL = 1 Public Const SW_SHOWMINIMIZED = 2 Public Const SW_MAXIMIZE = 3 Public Const SW_SHOWMAXIMIZED = 3...
  13. A

    How to sort (ORDER BY) a query

    I have a query, which look like this: SELECT tblSJAHeader.Department, tblSJAHeader.SJANumber, tblSJAHeader.SJATitle FROM tblSJAHeader ORDER BY tblSJAHeader.xxxxxxxxxxx; The ORDER BY part should be according to a selection in a combo box, meaning if "Department" is selected, then query should...
  14. A

    Open specific based on return from SQL statement

    Open specific form based on return from SQL statement I'm trying to get some code put together, so a specific form will open, based on a users 'AccessLevel'. However it won't work. This is the code I have so far: Private Sub Form_Timer() Dim strSecurityLevel As String Dim LID As Variant LID...
  15. A

    Why is the navigation pane suddenly showing?

    I have a database, where ribbons, navigation pane etc is disabled through the current database menu. When using the database, it more or less remain hidden. But when I run below code, the navigation pane suddenly opens, and stays open (well, it can be minimized and maximized, but not hidden)...
  16. A

    Checking if variable is a number

    I would like to check if contents of a text box is a whole number, i.e. not a decimal number and no letters. If it is not a whole number, it should set focus to the specific text box, and select contents, i.e. focus has to stay in text box, as long as contents is not a whole number. So far I...
  17. A

    Update a specific record based on value in a textbox

    I would like to update a specific record using below code. However it needs a bit of modification, as it updates all records, as it is right now. I need it to update a record based on a value which is in a textbox. I have tried including a WHERE clause, but that doesn't work. It just goes...
  18. A

    Print report using vba

    Currently when I print a report (the specific data for the report is chosen from a combo) by a click on a button, the report opens (preview), prints and close again. I use this code for doing so: Private Sub cmdPrint_Click() If Me.cboSelectDate <> 0 Then DoCmd.OpenReport "rptSJAView"...
  19. A

    Use of AND in a IF ... THEN sentence

    When I use below code, the data in the table is updated, but the msgbox after the FOR ... NEXT is not showing: ... For counter = 1 To 10 If Not Me("chkSJABody" & counter).Value = False And Me("chkCanEdit" & counter).Value = False Then Set db = CurrentDb Set rs = db.OpenRecordset("SELECT *...
  20. A

    Updating table with code

    On a form I have below code to update records in a table. It is the input from two checkboxes and two combos, which are shown 10 times each (each have same names, but with af 1-10 in the end, in order to use Counter). I use the For...Next method to go through each "row" of the controls, up to...
Top Bottom