I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year")
combo box 2 named "cbowwselect" 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 "DataTypeMismatch" error:
where is my mistake?
Thanks a lot in advance
Bea
10 3027
I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year")
combo box 2 named "cbowwselect" 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 "DataTypeMismatch" 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]) &"
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.
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.
Hi all,
thanks so much for all your help...
I've changed "Year" filed name and used the last suggestion successfully!!!
thanks thanks thansk!!!!
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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,...
| |