Urgent - Making linked forms, like the wizard does but in design view!

Edd,

If you put all the checkboxes, in the main table, change your query
a bit, their names are OK. Then you should have no trouble
making the buttons work.

I will hang around for a while, let me know if you have trouble.

Wayne
 
i'll put them all in one table... what about all the bound stuff? i can't get the buttons to work to save my life! don't worry about the pics etc, get rid of them all!
 
Edd,

Put them in the Customer table, they do pertain to the
customer, leave them on the form as they are, change the
query on the form to include them from the CUSTOMER
table, they are now bound to it and Access will take care of
it.

Wayne
 
i've done it (all teh checkboxes are In the customer table, then used the wizard to add everything in customer table and trip table, then trip becomes linked form to customer) and it all looks ok the button opens up the trip table, - but when new customer records are added teh new customer number is not added and a new trip is nto created - VERY wierd i don't know WHAT is going on
 
when i look at the table view of the customer table, and then click the little '+' sign to see it's subtable, it has teh trip table MINUS the customerID foreign key. What the hell? Who gave it permission to do that? The customerID is indeed present in the actual trip table, but not in the trip subtable viewed in teh customer table.
 
Edd,

Look At Tools --> Relationships

You can delete all. Obviously someone set this up, but to make
it work, you will need a subform for each table.

Then just add the individual checkboxes to your Customer table
and you're good to go.

Wayne
 
but if i do the same thing with the wizard but use a subform instead of a linked button thing, it 'works' (the correct customerID is stuck into place, the correct trip info comes up). Back to square one! Why won't that damn thing work as a button!
 
perhaps i will just say that they have to have a subform and can't have a button - they can go screw themselves eh

i'll keep trying though

sorry i must be getting on your tits. feel free to go off and do stuff you gotta do man.

Thanks again!
 
Edd,

I hate to say this, but we're facing some serious time
constraints. Make a copy of your db.

Delete all of the relationships.

Add the Checkboxes to your Customers table.

Change the form's query to include the checkboxes from the
customer table.

You will be able to add the buttons for the trip info and
the telephone thing.

Wayne
 
Tried. When i use teh wizard and add all the customer fields and the trip fields, it says that some of these tables aren't related. So i try to add the buttons manually, and don't link to the customerID of the new records. Then i went and added a relation from csutomerID in teh customer table to the customerID in the trip table, and i get the same problem as adding the buttons manually - the customerid's wont' match up.

I think it's time to admit defeat for me!

Thanks for your help - don't want to keep you any longer if you have to go man!
 
Edd,

Read my last post.

We will add the buttons later, If we lose the relationships,
add the checkbox fields to the customer table, and change
the customer1 form's query to get the checkboxes from
the customer table then we're 90% there.

We'll add the buttons later.

Wayne
 
oh yeah

i've got rid of all relations, and made a form with all the customer fields (which now include the checkboxes). I'm forgetting the buttons for now then mate.

Cool?
 
Edd,

The button is just going to be:

DoCmd.Openform "Trip5",,,"[CustomerID] = " & Me.CustomerID

On the Trip5 Form, set the property of CustomerID to
Locked = True (don't want them to change it) and set its
default value to: =Forms![Customer1]![CustomerID].

That will restrict the form to only the customer's trips and
any new ones will get the customerID from the Customer form,
and they can't change it.

The same for the other button.

Now, back to those checkboxes, they are now our hardest part.

Wayne
 
Edd,

You will have to redo your telephone log form, (make it like trip5)
right now its an unbound with a subform. Just make it like the
trip5 form and the code for the button and the default value
will be similar.

Wayne
 
when clicking the button, the customerID in the trip form comes up with '#Name?' instead of the actual number? however for the previous entries made when the trip form was a subform, the customer ID's show up! it's for new entries that #Name? shows up?!

Kill me plz
 
Edd,

Button? I take it that the checkboxes are in the customer table
and properly bound to the form?

If so then cut and paste your code for the button and we're
almost done. The #name means that where you have

DoCmd.OpenForm "Trip5",,,"[CustomerID] = " & Me.CustomerID

it doesn't understand Me.CustomerID

Wayne
 
i've got
Code:
Private Sub Command76_Click()
On Error GoTo Err_Command76_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Trip5"
    
    stLinkCriteria = "[CustomerID]=" & "'" & Me![CustomerID] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command76_Click:
    Exit Sub

Err_Command76_Click:
    MsgBox Err.Description
    Resume Exit_Command76_Click
    
End Sub

any ideas?
 
No single quotes, its a number.

DoCmd.OpenForm "Trip5",,,"[CustomerID] = " & Me.CustomerID

Wayne
 
i've got
Code:
Private Sub Command76_Click()
On Error GoTo Err_Command76_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Trip5"
    
    stLinkCriteria = "[CustomerID] = " & Me.[CustomerID]
    DoCmd.OpenForm "Trip5", , , "[CustomerID] = " & Me.CustomerID
    
Exit_Command76_Click:
    Exit Sub

Err_Command76_Click:
    MsgBox Err.Description
    Resume Exit_Command76_Click
    
End Sub

and i get a "The openform action was cancelled" error when i try to press the button
 
Edd,

Your code is fine, this is just an Access thing.

Choose File --> Save

Choose Tools --> Database utilities --> Repair/Compact

Then exit and restart the app.

Try again.

by the way,

Are the combo boxes OK?

If so, we're almost there.

Wayne
 

Users who are viewing this thread

Back
Top Bottom