PC Review


Reply
Thread Tools Rate Thread

Lookup Table Editor

 
 
Dorian Chalom
Guest
Posts: n/a
 
      3rd Aug 2003
Thanks for responding....it was most helpful.

In response to your last comment...

> I'm not sure what you wanted with the code in cmbTable_AfterUpdate,
> but I'd say, there is not much use to search a record in the form if
> the user has selected the table but no field from that table.


I would want to search for records based off the Table selected and the
first value in the list of Fields.
And thus display the first value in the list of fields as the active field,
much the same for the table. I guess I want to default to the first Table
and Field in the list rather then Null.

Thanks again for your help
Dorian Chalom" <(E-Mail Removed)> wrote:

>Screen is:
> Table:
> Field:
> Value:
>
>Table is:
> Table
> Field
> Value
>
>How do I set this up so that when I select a Table the Field is filtered to
>those Fields for that Table and the Value is filtered to the Vaules for the
>Field selected. Then when the Field is selected the Values are filtered to
>the values for that field?
>
>Do you understand?
>Can you help?


Dorian,

there was understanding and help :-) You may want to set the 'watch
thread' flag when you download your message's header.

This I wrote you on your first message on the same subject, it answers
your problem as you put it now:

I assume you would want to display in the 2nd combo the fields of the
table chosen in the 1st, then filter the form with the chosen table
and the chosen field. If so, you must first set a criteria in the
query for the 2nd combo to limit the list of field names to the chosen
table. The SQL view would look something like this:

SELECT DISTINCT Field, Table FROM MyInfoTable WHERE Table =
Forms!MyForm!cmbTable

The code would look something like this:

Private Sub cmbTable_AfterUpdate()

If Not IsNull(Me!cmbTable) Then
'Update the list in cmbField to show
'the chosen table fields
Me!cmbField.Requery
Else
'No table chosen, so reset the field combo
Me!cmbField = Null
End If

cmbTable_AfterUpdate_Exit:
Exit Sub

cmbTable_AfterUpdate_Err:
MsgBox Err.Description
Resume cmbTable_AfterUpdate_Exit

End Sub

Private Sub cmbField_AfterUpdate()
' Find the record that matches the control.
Dim strWhere As String

On Error GoTo cmbField_AfterUpdate_Err

'Check if there is criteria chosen and
'proceed only when yes
If Not IsNull(Me!cmbField) Then
'Put together the filter criteria
strWhere = "[Table] = '" & Me!cmbTable & "' AND [Field] = '"
& Me!cmbField & "'"

'First, delete the filter set previously
Me.FilterOn = False

'Set the filter
Me.Filter = strWhere
Me.FilterOn = True
End If

cmbField_AfterUpdate_Exit:
Exit Sub

cmbField_AfterUpdate_Err:
MsgBox Err.Description
Resume cmbField_AfterUpdate_Exit

End Sub

Some remarks to your original code: you don't need to search the
recordset and set a bookmark if you want to set a filter in the form,
and you don't need to edit a recordset to set the form's bookmark.

I'm not sure what you wanted with the code in cmbTable_AfterUpdate,
but I'd say, there is not much use to search a record in the form if
the user has selected the table but no field from that table.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lookup Lookup Lookup =?Utf-8?B?TVI=?= Microsoft Excel Worksheet Functions 2 10th Mar 2005 02:59 AM
Lookup Table Editor Dorian Chalom Microsoft Access Forms 1 20th Dec 2003 12:06 AM
Lookup Table Editor Dorian Chalom Microsoft Access Form Coding 0 4th Aug 2003 02:34 AM
Lookup Table Editor Dorian Chalom Microsoft Access Form Coding 0 2nd Aug 2003 03:18 AM
Lookup Table Editor Dorian Chalom Microsoft Access Form Coding 0 2nd Aug 2003 03:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:53 PM.