Combo box choice checks a box in another database table via dlooku


B

Bill

Hi,

On a form is a combobox which selects a Purchase order number.

The Purchase order Number database is linked to the new Database where the
form is stored.

Upon selecting the number in Column 0 - say 12345 - in the after update I
wish the corresponding table in the Purchase Order Database to have a check
(Tick) added in the control called 'NAF" in the row corresponding to the PO
number 12345.

So far this is all my brain will allow me to think

Private Sub OrderRef_AfterUpdate()


Dim strFilter As String
'Evaluate filter before it is passed to Dlookup function
strFilter = "[OrderNumbers]= " & [OrderRef].Column(0)
'Update PO Table NAF control based on PO value selected in the combo box
Nz (DLookup("[NAF]", "[OrderNumbers]", strFilter))

rem OrdeNumbers.NAF = true

End Sub


How do I link the dlookup which finds the correct row and then check the
control - make it true?

Thanks in advance
 
Ad

Advertisements

N

ntc

make a standalone UpdateQuery

so that when the form's combobox is sitting there with 12345 selected; you
manually run that stand alone query and it updates the correct record,
correct field of the target table.

once you have that working; then just determine the best moment to trigger
that query to run.
 
B

Bill

Thanks ntc,

Is there a way of setting the criteria dirct from the form control withoput
being asked for the parameter value?

In the after update I run the query
Private Sub OrderRef_AfterUpdate()

DoCmd.SetWarnings False
DoCmd.OpenQuery "NAF_Tick" 'Append new record to the PO
DoCmd.SetWarnings False

End Sub

The criteria on the query is


[Me]![OrderRef]

I am running 2003.
Regards
Bill

ntc said:
make a standalone UpdateQuery

so that when the form's combobox is sitting there with 12345 selected; you
manually run that stand alone query and it updates the correct record,
correct field of the target table.

once you have that working; then just determine the best moment to trigger
that query to run.



Bill said:
Hi,

On a form is a combobox which selects a Purchase order number.

The Purchase order Number database is linked to the new Database where the
form is stored.

Upon selecting the number in Column 0 - say 12345 - in the after update I
wish the corresponding table in the Purchase Order Database to have a check
(Tick) added in the control called 'NAF" in the row corresponding to the PO
number 12345.

So far this is all my brain will allow me to think

Private Sub OrderRef_AfterUpdate()


Dim strFilter As String
'Evaluate filter before it is passed to Dlookup function
strFilter = "[OrderNumbers]= " & [OrderRef].Column(0)
'Update PO Table NAF control based on PO value selected in the combo box
Nz (DLookup("[NAF]", "[OrderNumbers]", strFilter))

rem OrdeNumbers.NAF = true

End Sub


How do I link the dlookup which finds the correct row and then check the
control - make it true?

Thanks in advance
 
Ad

Advertisements

N

ntc

in a standalone query your criteria would be:

Form![YourFormName].[OrderRef]

Form is literal


Bill said:
Thanks ntc,

Is there a way of setting the criteria dirct from the form control withoput
being asked for the parameter value?

In the after update I run the query
Private Sub OrderRef_AfterUpdate()

DoCmd.SetWarnings False
DoCmd.OpenQuery "NAF_Tick" 'Append new record to the PO
DoCmd.SetWarnings False

End Sub

The criteria on the query is


[Me]![OrderRef]

I am running 2003.
Regards
Bill

ntc said:
make a standalone UpdateQuery

so that when the form's combobox is sitting there with 12345 selected; you
manually run that stand alone query and it updates the correct record,
correct field of the target table.

once you have that working; then just determine the best moment to trigger
that query to run.



Bill said:
Hi,

On a form is a combobox which selects a Purchase order number.

The Purchase order Number database is linked to the new Database where the
form is stored.

Upon selecting the number in Column 0 - say 12345 - in the after update I
wish the corresponding table in the Purchase Order Database to have a check
(Tick) added in the control called 'NAF" in the row corresponding to the PO
number 12345.

So far this is all my brain will allow me to think

Private Sub OrderRef_AfterUpdate()


Dim strFilter As String
'Evaluate filter before it is passed to Dlookup function
strFilter = "[OrderNumbers]= " & [OrderRef].Column(0)
'Update PO Table NAF control based on PO value selected in the combo box
Nz (DLookup("[NAF]", "[OrderNumbers]", strFilter))

rem OrdeNumbers.NAF = true

End Sub


How do I link the dlookup which finds the correct row and then check the
control - make it true?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top