Automatic Populate record(s) in a continuous form using a combo box in that form and append field from another table MS Access - ms-access

enter image description here
I have tables named "TblWorksOnly" it has id, worktype and workname fields it has 22 fixed records i need ,"TblCustomers" it has Custfullname and id fields ,"TblLocations" it has idloc and LocName fields
and a form named "FRM_TblWorksOnly"
i need code vba to get data automatically from TblworksOnly based on comboboxs "CmbCustFullName", "cmbLocName" ,"cmbWorktype"
how to do this with button for each customer without repetition for one customer
thanks for all
answer to my problem in ms access

Related

I did a query in access that calculates a date, when I enter the date in a form I get the result in the query but not able to save it to the table

Pic hereI am new to MS Access. I have a customer table with creationdate field as well as submissiondate. The submissiondate was calculated via a query since it carries multiple conditions. I created a form from the customer table where I am able to input the creationdate field and I managed to show the submissiondate (from the query) via Dlookup but the date is not recorded in the customer table. How can I record the submissiondate value from the query in the customer table without having to do an update query every time I add a new customer? I did an update query but it updates all records every time it runs, and we have more than 50K customers. Any help is appreciated.
this is the query in Access that gets the result for me.
SELECT HardDeadlineCalculationQ1.ID, HardDeadlineCalculationQ1.R AS ReferralDate, HardDeadlineCalculationQ1.[Source of Referral], HardDeadlineCalculationQ1.HD1, HardDeadlineCalculationQ1.wdhd1, HardDeadlineCalculationQ1.hd2, HardDeadlineCalculationQ1.wdhd2, HolidaysT.holidaydates, Switch([HardDeadlineCalculationQ1].hd2=holidayst.holidaydates,"Yes") AS isholiday, IIf(isholiday="Yes",([HardDeadlineCalculationQ1.hd2]-1),[HardDeadlineCalculationQ1].hd2) AS hd3, WeekdayName(Weekday(hd3)) AS wdhd3, Switch(WeekdayName(Weekday(hd3))="Monday",(hd3),WeekdayName(Weekday(hd3))="Tuesday",(hd3),WeekdayName(Weekday(hd3))="Wednesday",(hd3),WeekdayName(Weekday(hd3))="Thursday",(hd3),WeekdayName(Weekday(hd3))="Friday",(hd3),WeekdayName(Weekday(hd3))="Sunday",(hd3-2)) AS hd4, WeekdayName(Weekday(hd4)) AS wdhd4
FROM HardDeadlineCalculationQ1 LEFT JOIN HolidaysT ON HardDeadlineCalculationQ1.hd2 = HolidaysT.holidaydates;
regards,
"The submissiondate was calculated via a query since it carries multiple conditions"
By this, i presume you mean that the submission date is a calculated field(as its control source)
Do the following
Copy the calculation, i.e formula and put in vba code, under the after update event of every field that is a variable in the expression.
e.g submissiondate= place the formular here
Then on the form remove the calculation , i.e formula from the control source of the form control and make a field in the table the control source, e.g submissiondate.

populating field data by Dlookup in access

I'm trying to populate data from a query (SUMA PALETS) that counts the records from a field (its related table is called "LOTES PRODUCTOS") to a field in a subform (PEDIDOS PRODUCTOS). Both, query (and its related table) and subform (and its related table) have a common field with the same value. This field is called "PRODUCTOPEDIDO" in SUMA PALETS query and in LOTES PRODUCTOS table and it is called "IdPEDIDOSPRODUCTOS" in the subform.
I'm using the next formula in the control source of the subform field (it's called "QUEDAN"):
=DLookUp("[CountofIdPEDIDOSPRODUCTOS]";"[SUMA PALETS]";"[PRODUCTOPEDIDO] = " & Forms![PEDIDOS PRODUCTOS]![IdPEDIDOSPRODUCTOS])
Where:
SUMA PALETS: It's the query name
PRODUCTOPEDIDO: table field I want to count
CountofidPEDIDOSPRODUCTOS: it's the query field that counts PRODUCTOPEDIDO field in the query
PEDIDOS PRODUCTOS: subform name
IDPEDIDOSPRODUCTOS: subform field name with the same value as - PRODUCTOPEDIDO in query.
But I get #Name? error in the subform field. I don't know where is the problem. Could It be because the field's name is the same in another tables?
I would like that QUEDAN field was updated instantly when I add records in LOTES PRODUCTOS field (by introducing data in a subform). I don't know If It`s the right approach or could It be better option If I write a query to get count values directly in QUEDAN field (I don't know much about queries in SQL).
Thanks in advance
Should be:
=DLookUp("[CountofIdPEDIDOSPRODUCTOS]";"[SUMA PALETS]";"[PRODUCTOPEDIDO] = " & Forms![ParentFormName]![PEDIDOS PRODUCTOS]![IdPEDIDOSPRODUCTOS])
You need to refer to the parent form before the subform.

Access Combobox read from other table & generate report

Hy all ,
I'm making an access 2013 databases application , for my work place with the scope to generate automatically some documents based on some combo box selections.
So in order , to be much more specific , the main form have :
one combo-box selection for truck number (cboNr_Auto) which reads from table "Advanced Conditional List" and fill auto text boxes for displaying name of driver , license number , etc... ( working well with afterUpdate event)
one combo-box selection for code of trash (cboCod_Deseu) which reads from table "Categorie_Deseuri" and display the name of the trash in text-box "txtDenumire_Deseu" ...(not working)
date pickers for loading and unloading dates- working well
text box for manual entry of weight - working well
My questions are next :
how can i make my combo-box selection "cboCod_Deseu" to display values in text-box from the table "Categorie_Deseuri" in my main form ?
how can i generate an report based on my combo-box selections , date pickers and manual entry for the weight field via a pushbutton?
Thanks
let say you have combobox with a recodsource and this recodsource returns 3 column.
Now if you want to set the textbox based on the selcted value of combobox than you can set the textbox controlsurce as below.
=[Combo0].[column](1)
'Combo0' is the name of combobox.
For report based on the different criteria.
first of all create a query for the report and change this query based on your criteria.
Below is the small example how you can acheive this.
Dim query_1 as string
query_1 = "Select * from Table1 where DATE = #yourdate#"
CurrentDb.QueryDefs("Report_Query").sql = query_1
Report_Query is the name of the query which you have saved earlier. open the report based on this.

How can I create labels for given input ID in MS Access

I'm Working on Northwind DB, I have a problem in MS Access.
I want to create labels for the dbo_Products with some fields. Till creating labels is fine but, if the User gives input as ("Ex. I Need labels for products with Id's in between 10 - 30") then the output should display labels only from 10 till 30. How can I do this operation ?
It should give outcome of specific labels as given by the User. I want to connect the data entry form to report such that if user clicks the button by inserting the ID values the labels in between the specified id's should appear.
Thank you. Your Help will be appreciated.
Set the filter property of the report to be "ID between 10 and 30".

Autocomplete Fields in Split Database

I created a data entry from and split my database to front-end and back-end. When I enter in data I want certain fields to autocomplete. To be specific, I want to do something like (assuming the term Request had been previously entered) when you type in Requ... it would show Request and you could just press enter or tab to move to the next field. I don't want the rest of the fields autofilled, just individual fields autocompleted. Not sure if the fact that the database is split prohibits this?
Using a form, set the controls for the fields you want to autocomplete to comboboxes and the row source of the combo to a select from the table:
Control Source : MyFieldToComplete
Row Source : SELECT DISTINCT MyFieldToComplete FROM MyTableWithMyField
Limit To List : No
There are wizards for building combos, or you can change controls manually with right-click.