I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSel ect" displayed as "Year" based on qry QryYearList ( only one field "Year")
combo box 2 named "cbowwselec t" displayed as "wk" based on qry Qry WkList (field: Year, wk) displaying only wk field.
OPEN FORM (2) BUTTON (@@@)
Form 2) all my data :
Year
wk
product 1
product 2 and so on
(@@@) in the OnCLick event procedure of this button I inserted the following code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Wkly_data_ WIP"
stLinkCriteria = "[Year]=" & Me![cboYearSelect] And "[wk]=" & Me![cbowwselect]
DoCmd.OpenForm stDocName, , , stLinkCriteria
But I obtain the "DataTypeMismat ch" error:
where is my mistake?
Thanks a lot in advance
Bea
10 3045
I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSel ect" displayed as "Year" based on qry QryYearList ( only one field "Year")
combo box 2 named "cbowwselec t" displayed as "wk" based on qry Qry WkList (field: Year, wk) displaying only wk field.
OPEN FORM (2) BUTTON (@@@)
Form 2) all my data :
Year
wk
product 1
product 2 and so on
(@@@) in the OnCLick event procedure of this button I inserted the following code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Wkly_data_ WIP"
stLinkCriteria = "[Year]=" & Me![cboYearSelect] And "[wk]=" & Me![cbowwselect]
DoCmd.OpenForm stDocName, , , stLinkCriteria
But I obtain the "DataTypeMismat ch" error:
where is my mistake?
Thanks a lot in advance
Bea
Try this:
stLinkCriteria = "[Year]= " & Me![cboYearSelect] & " And [wk]= " & Me![cbowwselect]
If it does not work, please provide sample of what the output is supposed to look like.
Try this:
stLinkCriteria = "[Year]= " & Me![cboYearSelect] & " And [wk]= " & Me![cbowwselect]
If it does not work, please provide sample of what the output is supposed to look like.
Hello PuppydogBuddy,
thansk for your reply, but the error persist also with your suggested modification.
I'll try to explain my problem better:
I have a form where I choose the interested period (Year & Wk):
selected these vallue I want to open a second form with all (filtered)
data related to the period (Year & wk).
If I apply the two condition in the linkcriteria separately they work without data type mismatch...
Thanks,
Bea
Hello PuppydogBuddy,
thansk for your reply, but the error persist also with your suggested modification.
I'll try to explain my problem better:
I have a form where I choose the interested period (Year & Wk):
selected these vallue I want to open a second form with all (filtered)
data related to the period (Year & wk).
If I apply the two condition in the linkcriteria separately they work without data type mismatch...
Thanks,
Bea
if year is numeric data type and week is text data type, the syntax would look like as shown below. Additional quotes needed to identify the parameter as a text data type.
Try this:
stLinkCriteria = "[Year]= " & Me![cboYearSelect] & " And [wk]= '" & Me![cbowwselect] & "'"
if year is numeric data type and week is text data type, the syntax would look like as shown below. Additional quotes needed to identify the parameter as a text data type.
Try this:
stLinkCriteria = "[Year]= " & Me![cboYearSelect] & " And [wk]= '" & Me![cbowwselect] & "'"
They are both Integer...I'm lost!!!
;-((((
Bea
They are both Integer...I'm lost!!!
;-((((
Bea
How are year and week displayed? Example 5 or 05? If 05, it is probably text.
How are year and week displayed? Example 5 or 05? If 05, it is probably text.
Wk is displayed as 5 and not as 05...
I've checked in all table/query and the field wk is defined Integer everywhere!
I've changed the Link Criteria in the following way:
stLinkCriteria = "[Year]= " & Val(Me![cboYearSelect]) & " And [wk]= '" & Val(Me![cbowkselect]) & "'"
And now the error message is: "The OpenForm Action was canceled"
I can't understand where is my mistake!
Thanks!
Bea
Wk is displayed as 5 and not as 05...
I've checked in all table/query and the field wk is defined Integer everywhere!
I've changed the Link Criteria in the following way:
stLinkCriteria = "[Year]= " & Val(Me![cboYearSelect]) & " And [wk]= '" & Val(Me![cbowkselect]) & "'"
And now the error message is: "The OpenForm Action was canceled"
I can't understand where is my mistake!
Thanks!
Bea
Bea,
the message is cryptic, so I am not sure. Maybe encountering a null?
if it is just a syntax problem, try it this way:
stLinkCriteria = "[Year]= " & Val(Me![cboYearSelect]) & " And [wk]= " & Val(Me![cbowkselect])
Try this one
stLinkCriteria = "[Year]= " & "&Val(Me![cboYearSelect])&" And "[wk]= " & "&Val(Me![cbowkselect]) &"
sierra7 446
Recognized Expert Contributor
Wk is displayed as 5 and not as 05...
I've checked in all table/query and the field wk is defined Integer everywhere!
I've changed the Link Criteria in the following way:
stLinkCriteria = "[Year]= " & Val(Me![cboYearSelect]) & " And [wk]= '" & Val(Me![cbowkselect]) & "'"
And now the error message is: "The OpenForm Action was canceled"
I can't understand where is my mistake!
Thanks!
Bea
A couple of things wrong with the above.
'Year' is a reserved word, it may work but should be avoided
You don't need quotes around the cboWkSelect term which I presume should be an integer
stLinkCriteria = "[Year]= " & Val(Me![cboYearSelect]) & " And [wk]= " & Val(Me![cbowkselect])
If this doesn't work you should consider changing the fieldname 'Year' which I appreciate may have a lot of knock-on consequences.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: JJ |
last post by:
Hi All,
When someone selects a value in a select on a form I want to show the
same form with another select with certain values depending on first select.
How can I do this? Should I keep acouple of arrays loaded with the second
selects values not to be shown till selected in first or what other means?
Also how do you reload the current form to show maybe a nex field or select
box?
|
by: NBruch |
last post by:
Ok let me explain what im trying to do:
i need a combo box which needs to be linked to a listbox (or combo box
doesnt matter which really) then the listbox should bring up the record
in a subform.
so you pick a name (in the combo box in the main form) then it should
bring up all the dates for which the person has a record for (in the
list box or combo box) and then once you pick a date it should bring up
the specific record you want...
|
by: Rosy |
last post by:
Hello all. I think my request is a simple one; however, I am unable to
figure it out by myself.
I need a form (frmCargoEntry) to open whenever the cargo dept is chosen
on another field. So when DeptId is equal to 1 then fromCargoEntry
should open on top of the current form for data entry. Can someone
help me with the correct phrasing? My main form is frmNewJobs.
Thanks. Karen
|
by: Cagey |
last post by:
What I'm trying for: If this selection or if click on selection
(highlighted line choice/
which ever selection change) w/in query's combo dropdown list box (on
Switchboard),
then Open in Datasheet View, the specific underlying record's Row...
showing all columns Or selected columns.
For a specific row's record ONLY, Or for all Xs (same type), or for the
whole data sheet
(all records... includes all types then), but focus still opens...
|
by: blyxx86 |
last post by:
Alright, I'm trying to create a form that would allow certain documents to be opened by selecting an option within a combo box and then having a single button to open the pertaining file.
I know how to have it open an excel document (or word, etc.) but do not know how to define which document to open.
Dim ExApp As Object
Set ExApp = CreateObject("Excel.Application")
ExApp.Workbooks.Open FileName:="c:\file.xls",...
| |
by: keri |
last post by:
Hi everyone,
I've started a new topic so as not to get people confused. I apologise
for the number of posts i've put on here over the last few days - i
really am trying to learn this stuff but my brain is getting a bit
frazzled.
I have a form based on the table appointments with fields as below
AppointmentNo (primary key - autonumber)
|
by: KPOJonesECC |
last post by:
I am currently working on creating a visual calculator in an access form. The visual bit being a graph and the interactive bit (or what I would like) being that by moving sliders on a series of sub forms in the main form, which I would like to auto select records as you scroll one way or another.
This would populate fields in the main form which linked by a query re-populates the graph via a setvalue macro, currently activated via the combo...
|
by: gcoaster |
last post by:
Hello,
Access is accessing my patience!
how does one filter just one form with a single combo box selection?
I have a combo box named "cboCallStatus" unbound
Row source type = Value List
values; OPEN, CLOSED
|
by: Jharp |
last post by:
Ok, so im really new to access and programing in general, what i am doing is building a inventory(something simple),
the way ive got it set up now is, my entire inventory is in a combo box, and what i want to be able to do is select an item from the combo box and have it open a window(form?).
ok so i got this far, i have it Onclick open a newform, and that works fine but it returns everything in inventory, so what i need it to do is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |