473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with combo box requery


I have a comobox in the main form which has a query attached to it to
list the employee numbers.I have written this code to requry the control
in the control's after update event

Private Sub CBOEmpNo_AfterUpdate()
Me![CBOEmpNo].Requery
End Sub

but still I am getting error

Is there any other tips regarding requery

can anyone offer any help

Regards
Dos lil
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
6 2090
Do you know which line of code that errors out? Error Number? Error
Description Text?

--
HTH
Van T. Dinh


"Dos Lil" <do****@hotmail.com> wrote in message
news:3f*********************@news.frii.net...

I have a comobox in the main form which has a query attached to it to
list the employee numbers.I have written this code to requry the control
in the control's after update event

Private Sub CBOEmpNo_AfterUpdate()
Me![CBOEmpNo].Requery
End Sub

but still I am getting error

Is there any other tips regarding requery

can anyone offer any help

Regards
Dos lil
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
Ray
Dos Lil <do****@hotmail.com> wrote in message news:<3f*********************@news.frii.net>...
I have a comobox in the main form which has a query attached to it to
list the employee numbers.I have written this code to requry the control
in the control's after update event

Private Sub CBOEmpNo_AfterUpdate()
Me![CBOEmpNo].Requery
End Sub

but still I am getting error

Is there any other tips regarding requery

can anyone offer any help

Regards
Dos lil
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Hello Dos,

Just one question. What are you doing in the combo
box that needs to run the After Update property to
requery it? Are you adding a new record? What?

Regards,

Ray
Nov 12 '05 #3

Thanks for the response.

Let me give you an overall scenario of what i am trying to do.I have a
combo list on the main form which is linked to the child form.The child
form is for the data entry purpose for the employee selected from the
main form.When I select the first emplouyee No in the combo i do not get
this message,but it is not inserting the employee number also selected
the from the main form.But when i select the second employee number from
the main form i get this error.I do not have any macro attached to the
coombo except for the code i have written for the control in the after
update event
The error message is "Macro or ites group macro does'nt exits /macro is
new and have'nt saved.Nit that when you enter macrogroupname.macroname
syntax in an argument you must specify the name the macro's macro group
was last saved under".

The other error I get is :The changes you requested was not saved cos
they would create dupliacte values in the index,primary key or
realtionship.remove the index or redifing the index or change the values
in the field."

I have written code for inserting the employee number to the subform
selcted from the main form
But still.....
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsSubform(Me) Then
If IsNull(Me.Empno) Then
Me.Empno = Me.Parent.Empno
End If
End If
End Sub

please help have been trying this for a week :)

Regards

Dos lil


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4
What is IsSubForm()? Is it a UDF?

Have you Compiled your code to see if there are compilation errors?

--
HTH
Van T. Dinh
MVP (Access)

"Dos Lil" <do****@hotmail.com> wrote in message
news:3f*********************@news.frii.net...

Thanks for the response.

Let me give you an overall scenario of what i am trying to do.I have a
combo list on the main form which is linked to the child form.The child
form is for the data entry purpose for the employee selected from the
main form.When I select the first emplouyee No in the combo i do not get
this message,but it is not inserting the employee number also selected
the from the main form.But when i select the second employee number from
the main form i get this error.I do not have any macro attached to the
coombo except for the code i have written for the control in the after
update event
The error message is "Macro or ites group macro does'nt exits /macro is
new and have'nt saved.Nit that when you enter macrogroupname.macroname
syntax in an argument you must specify the name the macro's macro group
was last saved under".

The other error I get is :The changes you requested was not saved cos
they would create dupliacte values in the index,primary key or
realtionship.remove the index or redifing the index or change the values
in the field."

I have written code for inserting the employee number to the subform
selcted from the main form
But still.....
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsSubform(Me) Then
If IsNull(Me.Empno) Then
Me.Empno = Me.Parent.Empno
End If
End If
End Sub

please help have been trying this for a week :)

Regards

Dos lil


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #5
IsSubform is a function which return true if the form is currently
loaded as a subform.And False if it is a stand-alone from.

I checked with the function code there seems to be no error.The error is
in the combo list of the main form.When I select the value from the
exixting list (EMpNO) Instead of selecting it is agian adding to the
table ,which is the result of the duplicate key entry since the EMPno in
the main table is PK.

All I need to do is to select from the combo and requery it .Please let
me know How I go with this.
I have a deadline next week

Thanks again


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #6
Not sure of your set-up but it seems to me that you want to use the ComboBox
for selection then the ComboBox should be an unbound Control, i.e. its
ControlSource should be blank. The fact that it adds Record seems to
indicate that it is a bound Control somehow.

Another point is that I am not sure why you want to requery the ComboBox
just after selecting a value. Logically for normal usage, this doesn't do
anything as the RowSource of the ComboBox canNOT depends on its value (or
you get a circular reference).

--
HTH
Van T. Dinh
MVP (Access)

"Dos Lil" <do****@hotmail.com> wrote in message
news:3f*********************@news.frii.net...
IsSubform is a function which return true if the form is currently
loaded as a subform.And False if it is a stand-alone from.

I checked with the function code there seems to be no error.The error is
in the combo list of the main form.When I select the value from the
exixting list (EMpNO) Instead of selecting it is agian adding to the
table ,which is the result of the duplicate key entry since the EMPno in
the main table is PK.

All I need to do is to select from the combo and requery it .Please let
me know How I go with this.
I have a deadline next week

Thanks again


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mark | last post by:
I've been working on an Access 2000 database for a couple of weeks now. I took a course in access about a year ago, a crash course, and I learned a ton, but I didn't touch Access for the year since...
4
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
1
by: Apple | last post by:
Thank you Alex, I have tried your suggestion to add requery in the afterUpdate Form's event, but it seems not work. The afterupdate event in my unbound combo box is : SetValue, GoToControl, Find...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
2
by: jay | last post by:
Hi. I have created an unbound combo box in a form whose purpose is to pass parameters to a query and then requery the requery. The unbound combo box is named "ClosedFilter" The two parameters...
1
by: Bill | last post by:
Problem: Combo box data disappears from view when a requery is done See "Background" below for details on tables, forms & controls On a form, I want to use the setting of bound combo box C1...
12
waynetheengineer
by: waynetheengineer | last post by:
Hi, I have a combo box on a form with a list of cities in it based on a single field city table. I also have a command button on this form that opens up another form that allows the user to enter...
4
by: Swinky | last post by:
I am trying to make a combo box dependent on a text box. I cannot get the combo box to pull the related data from the text box. I have been all over this user group & have tried several versions...
12
by: Lnwolf | last post by:
Hello, I am having an issue with my synchronized combo boxes and don't know how to fix it. I have created two boxes and have made the synchronization work (the user clicks on the first box and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.