Results 1 to 6 of 6
  1. #1
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10

    Strange problem combobox controll Access

    Hello,

    I have a strange problem!
    I programming a database for 2 countrys so in Dutch and English in the same database

    I have 2 different forms:
    Form Quotes and a Form Invoices
    In the 2 forms i have a combobox controll "cboCommentaar"

    cboCommentaar is loading defaults texts from a table that is shown in cboCommentaar
    in the Form Invoices Works fine even if i change the country UK or BE(Belgium) i get the texts
    So i can drop down controll cboCommentaar with the values from the table.

    The Problem i have Form Quotes
    i get the texts if Country is set to BE(Belgium) but i have no data if set to UK (Same texts same table)

    if i use another controll combobox vb ComboboxNew then it works well for BE or UK
    If i delete or change the name "cboCommentaar" on the form Quotes > my form gets corrupt!!

    Even i made a new form and the result gaves the same problem.
    Not possible to delete the controll "cboCommentaar" without my form gets corrupt!

    Anyone an idea to solve this?

    Thanks,


    Marc.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    What happens to your form that leads you to believe it's corrupted other than it's not working?

    It would help to see your code.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    See below code behind openform "frmOffertes"
    there is no other code that refers to "cboCommentaar"

    Private Sub Form_Open(Cancel As Integer)
    '2025 On Error Resume Next
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
    Dim intAantalOffertes As Integer


    Call ControleCode("frmFacturen")
    If blnRegcodeOK = False Then DoCmd.Close acForm, "frmFacturen"

    'FOUT Call ControleCode("frmOffertes")
    'FOUT If blnRegcodeOK = False Then DoCmd.Close acForm, "frmOffertes"

    ''================================================ ==========
    DoCmd.MoveSize 2000, 2000, 21500, 12400

    '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!
    'DATABASE UK of BE +VERTALINGEN

    Call ModFormTaalKeuze("frmOffertes")

    Dim strSubfrm As String
    strSubfrm = "frmOffertesDet"
    '---------------------------
    Dim rst As DAO.Recordset
    Dim ctl As Control

    strSQL = "SELECT tbl001TaalTabel.WoordID, tbl001TaalTabel.FrmNaam, tbl001TaalTabel.ControllName, tbl001TaalTabel.Done, tbl001TaalTabel.Nederlands, tbl001TaalTabel.Engels, tbl001TaalTabel.Frans From tbl001TaalTabel WHERE (((tbl001TaalTabel.FrmNaam)=""" & strSubfrm & """));"

    Set db = CurrentDb
    Set rst = db.OpenRecordset(strSQL)

    For Each ctl In Me.Form(strSubfrm).Controls
    If ctl.ControlType = acLabel Then
    rst.MoveFirst
    Do Until rst.EOF
    Select Case CurrCountry
    Case "BE"
    If ctl.Name = rst!ControllName Then ctl.caption = rst!Nederlands
    'FORMAT BE IN €
    Me.txtOfferteTotExBtw.Format = "€ #,##0.00"
    Me.txtOfferteTotBtw.Format = "€ #,##0.00"
    Me.txtOfferteTotInclBtw.Format = "€ #,##0.00"
    'KEUZELIJST COMEMNTAREN VULLEN

    Case "UK"
    If ctl.Name = rst!ControllName Then ctl.caption = rst!Engels
    'FORMAT UK IN £
    Me.txtOfferteTotExBtw.Format = "£ #,##0.00"
    Me.txtOfferteTotBtw.Format = "£ #,##0.00"
    Me.txtOfferteTotInclBtw.Format = "£ #,##0.00"
    'Debug.Print ctl.Name & " " & rst!ControllName; " " & rst!Engels
    'KEUZELIJST COMEMNTAREN VULLEN

    End Select
    rst.MoveNext
    Loop
    End If
    Next ctl
    rst.Close

    '================================================= ====================
    'Ophalen vooraf ingestelde vervaldagtermijn
    Me.cboVervaldagen = DLookup("[ParamW1]", "tblParamBE", "[ParamID] = 24")

    Me.Refresh
    strSQL = "SELECT * FROM tblOffertes"
    Set db = CurrentDb
    Set rs = db.OpenRecordset(strSQL)
    intAantalOffertes = rs.RecordCount

    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing

    End Sub

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    I have to assume your variable CurrCountry somehow is retrieved from the questionable combobox cboCommentaar. Perhaps it's not working as you expect and is never assigning value "UK" to CurrCountry.
    Hard to be very sure because your posted code shows nothing for cboCommentaar or how CurrCountry gets its value.
    Have you tried setting a breakpoint and stepping through your code?

  5. #5
    MarcoPolo is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    10
    Thanks for your answer,
    I just found the error, cboComment was still in a module with a reference, this caused the error.
    In any case, thanks for your attention.

    Marc.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Please post code within code tags if more than a few lines and where indentation would help see the logic.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. end user report controll
    By buienxg in forum Programming
    Replies: 1
    Last Post: 11-21-2011, 10:55 AM
  2. Replies: 5
    Last Post: 08-29-2011, 04:06 PM
  3. Strange Problem w/ Excel File
    By batowl in forum Import/Export Data
    Replies: 1
    Last Post: 06-30-2011, 03:25 AM
  4. Strange Problem
    By crowegreg in forum Forms
    Replies: 10
    Last Post: 06-17-2011, 10:32 AM
  5. Replies: 6
    Last Post: 03-17-2010, 10:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums