Thema Datum  Von Nutzer Rating
Antwort
Rot Use the Me. Statement with a String
23.05.2017 16:25:40 Sönke
NotSolved
23.05.2017 16:35:07 Gast5092
NotSolved
23.05.2017 16:49:30 Gast4803
NotSolved
23.05.2017 17:27:51 Gast83883
NotSolved

Ansicht des Beitrags:
Von:
Sönke
Datum:
23.05.2017 16:25:40
Views:
990
Rating: Antwort:
  Ja
Thema:
Use the Me. Statement with a String

Dear Community,

I step between my Controls and if it is a Checkbox I manipulate the name to the Name of the textbox and I try to use it with the Me. Command to reference to the Textbox in the Form for Searching in a Table. The problem is, that the Me. Command was interpreted as a String and not as a Reference on a Textbox in the Form. Is there a way to use the Me. Command with a string to get the value of the textbox in the form?

Dim ctl As Control
Dim sArray() As String
Dim sCheckboxname, sTextboxname, sTemp, stest As String


For Each ctl In Me.Controls
If (ctl.ControlType = acCheckBox) Then
sCheckboxname = ctl.Name
sArray = Split(sCheckboxname, "_")
sTextboxname = "txt_" & sArray(1)
sTemp = "Me." & sTextboxname


stest = "([" & sTextboxname & "] = ' """
stest = stest & " & " & sTemp & " & """
stest = stest & " ')"
sResult = "Select * from " & Me.Form.RecordSource & " where (" & stest & ")"

sCheckboxname = sTextboxname

End If

Set ctl = Nothing
Next ctl

With kind regards

Sönke


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:

 
 

  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
Rot Use the Me. Statement with a String
23.05.2017 16:25:40 Sönke
NotSolved
23.05.2017 16:35:07 Gast5092
NotSolved
23.05.2017 16:49:30 Gast4803
NotSolved
23.05.2017 17:27:51 Gast83883
NotSolved