Set continuous form textbox labels

howling_muffin

New member
Local time
Today, 07:16
Joined
Jul 29, 2020
Messages
11
I have a continuous form with a textbox, and I'm setting Form.RecordSource to the data I need displayed, but nothing's displaying.
I'm having a hard time understanding how to assign query data to an element in a continuous form. I would usually do Me.LabelName.Caption = "Assign value." but here I want each value in the query data to be in another LabelName.
I've searched a long time but there doesn't seem to be much on continuous forms.
Any help on this?
 
Hi. Not sure I follow. You said you want to assign data to textboxes, but you use "LabelName.Caption" in your code. Why can't you just bind the form to the query?
 
Hi. Not sure I follow. You said you want to assign data to textboxes, but you use "LabelName.Caption" in your code. Why can't you just bind the form to the query?
Sorry if I haven't explained well...
The textbox has a label, and I want each label to display the query data (which in this case is a name), so that the user can fill in the textbox
 
I'm not following you either.. However I think you should use a text box displaying information from the query instead of trying to assign information "a name" to a label. Gather the name with the same query, and show it in a text box adjacent to the text-box you want to fill in
 
show it in a text box
How do I do that? Normally to set the value of a textbox I would use something like
Code:
Public Property Let Name(value As String)
    Me.txtName.value = value
End Property

but because this is a continuous form I haven't got a value, I've got a SQL string which I think I'm supposed to be setting as the RecordSource, but don't know how or how to tell RecordSource to apply its data to my Name textbox and not any other element on the form...?
 
Hi. Are you able to post a sample copy of your db with test data? We are all having a hard time understanding what you're trying to do. There should be no code necessary.
 
I've got a SQL string

The SQL statement will provide you with a set of Records. To test this create a query based on your SQL statement. This query should list the records you expect to see, if it doesn't, you need to adjust it until it does.

Once you have the query working OK, create a form based on that query. The form will automatically generate text boxes which will show the data provided by the query.

Change the properties of the form so that it displays in continuous view and it will list the data for you.
 
But don't know how or how to tell RecordSource to apply its data to my Name textbox and not any other element on the form...?
you set the textbox controlsource to the name of the field you want to display.

Assuming your recordsource is the name of a table or query - have you tried using the wizard to create a form? simply click on the table or query (don't open it) then in the ribbon select Create>Form. Alternatively have you looked at one of the many templates to see how it is done there?
 
you set the textbox controlsource to the name of the field you want to display.

Assuming your recordsource is the name of a table or query - have you tried using the wizard to create a form? simply click on the table or query (don't open it) then in the ribbon select Create>Form. Alternatively have you looked at one of the many templates to see how it is done there?
Well it's not really the same question but I never got the hang of making a query with parameters that can be passed in programmatically, and I'm trying to pick my VBA battles over here :).

Which templates are you referring to?
 
you set the textbox controlsource to the name of the field you want to display.
So the Form.RecordSource is set to the sql string that contains the query, and the Textbox.ControlSource is set to the name of one of the fields returned in the query. Is that it?
 
pretty much

with regards templates go to file>new - they are all listed there. Since I don't know what your app is supposed to do I can't suggest a specific one - they are all in separate folders, depending on the type of app (contact management, financial planning etc)
 

Users who are viewing this thread

Back
Top Bottom