DLOOKUP Value In textbox Unable to save into table MS Access - ms-access

After having a successful Dlookup function,am able to autofill my two textbox, one for the combobox and the other for the text,but now,when I click save only the combobox is able to save,the textbox is not saved in the table.how can i save both by clicking save
https://i.stack.imgur.com/6CF10.png
https://i.stack.imgur.com/d7TYf.png

Related

Bound combobox goes empty in Access Report

I've got an Access Form with a combobox bound to a query that selects 2 fields. I managed to get the combobox showing up the query's second column by setting up in the combobox's Property Sheet the following: Column Number = 2 (with the first column width = 0); Bound Column = 1 (because it contains a value input for another query).
My problem is that when I open the Form, choose a value from the combobox and then save the Form as a Report, the combobox goes blank! In the Report I don't find the value previously selected for the combobox in the Form.
How can I fix it?
It appears you are looking to give the end user the ability to print what they see on the data entry form. But in access the printing functions are attached to reports. So we need a report that looks like the data entry form and some way to access the report from the data entry form. So add a print button or some such that will open the report. The report needs to look like the form so saving the form as a report is a good jump start but then some comboboxes don't show. Skip to the end for an explanation why. So we have to set the problem report comboboxes manually. One way is to pass parameters to the report when it opens:
Private Sub PrintButton_Click()
'look up DoCmd.OpenReport if you want to do something other than print preview
DoCmd.OpenReport ReportName:="ReportSavedFromForm", OpenArgs:=OriginalformComboBox.Value, View:=acViewPreview
End Sub
Private Sub ReportSavedFromForm_Load()
reportCombobox = Me.OpenArgs
End Sub
As to why the combobox is blank or stuck on the first value, according to the following link reports are not supposed to be used for editing data.
https://social.msdn.microsoft.com/Forums/office/en-US/14c6ec9a-53bd-4546-ba0e-597c41ca7cce/combo-box-drop-down-arrow-invisible-on-reports?forum=accessdev\
So the combobox dropdown arrow will not appear by design. I put this to the test in office 2016 and in the report header and report footer sections the combobox appears blank if the combobox is unbound. If the combobox is bound say to an ID the combobox behaves a little differently. It shows the first record but is just a textbox with no drop down arrow so only the first record ever shows. However in the details section while you still don't have the dropdown arrow the combo box still can be used to replace an id with a more friendly value

How to use combobox to open specific form in Ms Access

How can we open specific form based on what we click in the combo box? I tried using macro but it only can be used for 1 value of the combo box only (cannot assign specific form for all value of combo box)
Goto to Combo box properties and select Macro builder
Using Macro you can define all conditions and respective actions.

MS Access - Modify data in Form and save record

I have a simple question but somehow I just couldn't find a proper solution online.
In a form there is a text box. It gets its data via dlookup from a table.
With a button I want to allow editing by setting
Me!AllowEdits = True
So save there is a button with the code
DoCmd.RunCommand acCmdSaveRecord
Anyway - by clicking the editing button I'm not able to modify the text written in the text box.
Why are you using DLookup()?
The acCmdSaveRecord command will not save calculated data. This value returned by DLookup() will not be saved to table without first running code to save it into a field, like Me!fieldname = Me.textboxname. So you can have another textbox BOUND to that field and that textbox can be editable.

How to make Dlookup textbox writeable

I am working on forms and made a single form for data entry and search ( data extraction) but the problem is that i used Dlookup formula on some textboxes for ease in data entry but when i attemp to search access doesn't show data on that textbox and shows the error that the object is read only.
How can i get the textbox show data as well as have Dlookup formula?
Kindly help.
Many thanx
You can set the textbox value by code instead of putting the DLookup into the data source of the textbox.
Putting it into the data source means that you can't edit the textbox at runtime, as you experienced.
But you can set the value once in the Form_Open event, for example:
Private Sub Form_Open(Cancel As Integer)
Me.TheTextBox = DLookup(...)
End Sub
This will cause the textbox to be filled automatically when the form opens, but the textbox is editable and you can overwrite the value.

MS Access Double click event on query

MS Access 2007, Win 7 32-bits
Is there a way where I can access an open query in datasheet view in access to get the current field value and current field name?
I won't put it into a form since it is a crosstab query and i'd have to generate and get rid of controls dynamically but i'm not fond of messing with forms controls that way with VBA. I know i can put a dynamic column report and bind an event on the controls but I'm asking if there are events or objects that can let me access directly the query.
Perhaps a recordset clone? But I haven't find anything on google.
Of course this is in VBA
Best regards,
It may be possible to work around your requirements. The crosstab is contained by a subform:
Source Object : Query.xtab
The Control Source for the two textboxes is:
Ctrl : =[screen].[activecontrol].[name]
Content: =[screen].[activecontrol]
Which means they show which ever column ans column contents the user selects in the crosstab subform. However, they will also show any other selected control on the form. ClickMe does not change the selected control, so the selected items remain the same in the textboxes.
You can also enter MacDermott's code for getting the current control's index, so the current control selected on the xtab query subform is displayed dynamically
Public Function ControlIndex(ctl as Control) as long
Dim i as Integer
For i=0 to Me.Controls.Count-1
if me.Controls(i) is ctl then
ControlIndex=i
exit for
end if
next
End Function
And finally this can help when changing from one control to another in the same record to keep the textboxes current.