|
|
|
2nd Request - Combo box problem |
| message from =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 18 May 2004 |
Above is my previous message, which i left under forms. I'm not sure where to post it.
Does ANYONE know how to fix this, or have i mis-stated my problem? This is a catch-22 that someone has to have encountered before. I can't save the record until i enter the data, and i can't enter the data until i save the record. What am i missing, here. Please help me , or can you refer me to another source. Thank you.
|
| Pavel Romashkin replied to =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 18 May 2004 |
I think the lack of enthusiasm you are seeing is related to the
difficulty understanding your design.
I am not sure what you mean by "combo boxes refer to two separate
tables". Clearly, the new data can not be on the list, but what is it
"to open their respective tables"?
What are the combos supposed to do? Are they bound? What is their row
source? What is the form based on?
Please patiently and briefly summarize your design and state your
intention if possible, not just description of what is not working.
I am guessing that one combo is using an autonumber in its source that
has not been generated yet, but this is pure speculation.
Pavel
GaryRuffin wrote:
|
| =?Utf-8?B?R2FyeVJ1ZmZpbg==?= replied to =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 19 May 2004 |
Pavel,
Thanks for your reply. I'll try to clarify. My database has a total of 3 tables, "ORGS”, “EMPS” and “DIRS". Only the DIRS table has an auto-number key. That table also has one lookup field from each of the other two tables, which are their respective keys, and are joined one-to-many. (One record in ORGS to many in DIRS, one record in EMPS to many in DIRS.)
My DIRS input form has a combo box for each of those key fields, intended to show the related data on the form. One of the combo boxes, EmpName, works perfectly: enter a name on the list and all related EMPS fields populate, or enter a name not on the list and an EMPS form opens to add the related data in a new record on the EMPS table. There’s a button on that form to save the record and return to the DIRS form, where the EMPS fields are now populated.
But, although I designed it the same way, the other combo box, OrgName, will not allow any input at all. When I type or click, I get the message “To make changes to this field, first save the record.” I have checked all properties for both combo boxes and they are the same.
I hope that’s clearer. Any idea what I am missing here? I really appreciate your help. Thanks.
|
| Pavel Romashkin replied to =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 19 May 2004 |
Gary,
What is the record source of the form?
Is DIRS using a simple AN primary key or is it a compound key?
If the combos are truly identical, there must be a difference in how the
foreign keys are used in the form's record source.
Do you have code executed by the combo box?
Pavel
GaryRuffin wrote:
|
| =?Utf-8?B?R2FyeVJ1ZmZpbg==?= replied to Pavel Romashkin on 19 May 2004 |
Pavel,
The record source for the form is a select query, DIRS Query.
DIRS table uses a simple AN primary key.
I will review how my query uses the foreign keys – any ideas about I what should look for specifically?
I have code on the first combo box like this:
Private Sub DIRS_EmpName_NotInList(NewData As String, Response As Integer)
Dim strsql As String, x As Integer, strMsg As String
Dim LinkCriteria As String
strMsg = "Would you like to add" & vbCrLf & vbCrLf
strMsg = strMsg & "'" & NewData & "'"
strMsg = strMsg & vbCrLf & vbCrLf & "to the list of Employees?"
If MsgBox(strMsg, vbYesNo, "Add New Employee?") = vbYes Then
strsql = "Insert Into EMPS ([EmpName]) values ('" & NewData & "')"
CurrentDb.Execute strsql, dbFailOnError
LinkCriteria = "[EmpName]='" & NewData & "'"
DoCmd.OpenForm "EMPS", , , LinkCriteria
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
And the code on the second combo is identical, except for the field and table references.
Any ideas? TIA
|
| Pavel Romashkin replied to =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 19 May 2004 |
If your db is not very big without data and you can post it on the web,
I'd be glad to take a look for you becasue so far I see no flaws in your
code, so something else must be wrong. If you can't post the db, lets
keep digging deeper.
Looks to me that combo box 2 is bound to a non-updateable join query.
Can you post the DIRS query? What events are used by the failing combo
box? Could you post code for those events?
You are saying that the error occurs immediately upon clicking. If you
are sure there is no code in GetFocus, KeyDown or Click events, one last
thing I can suggest is making another combo box, duplicating all the
functionality from the bad one and seeing if it works. I had two
instances in the last three years when a copy-pasted control just "went
bad", and making another and throwing the bad one away remedied the situation.
Pavel
GaryRuffin wrote:
|
| =?Utf-8?B?R2FyeVJ1ZmZpbg==?= replied to Pavel Romashkin on 19 May 2004 |
Pavel,
Thanks for you offer to help and your continued patience. I'm not sure how to post the database, so I've tried re-creating the combo box. In doing that, I discovered that 2 of my fields were not being called in the SQL. Both are memo fields. Is this a known trait of memo fields? Since neither field has data that exceeds the 225 limit, I'm going to try changing the field types to text and re-work both the query and the combo box. I'll let you know if that solves it. Thanks again.
|
| Pavel Romashkin replied to =?Utf-8?B?R2FyeVJ1ZmZpbg==?= on 20 May 2004 |
Gary,
I hope this solves the problem. Re-post if you don't get it solved.
By posting I meant putting a ZIPped copy of the db after purging the
(confidential) data on a web or ftp site and sending me the URL by
E-mail so that I can pick it up and take a look.
Pavel
GaryRuffin wrote:
|
| =?Utf-8?B?R2FyeVJ1ZmZpbg==?= replied to Pavel Romashkin on 24 May 2004 |
Pavel,
I finally got it working... I re-created my combo boxes, and the query. I'm still not sure what was wrong. Thanks for all your help.
|
|