I would really like to see client name and client ID come across..... if you might be so generous to show me the added code that I can use to have both come across I would be extremely grateful for your time!
I only use the ClientID in the openArgs. You don't need to "Send" the client name across. You obtain it in the time form as you'll see below.
heres the code with comments
In the new client form:
Code:
Private Sub btoSubmit_Click()
Me.Dirty = False 'This explicitly saves the new client record
DoCmd.OpenForm "frmTime", , , , acFormAdd, , Me.ClientID ' this line opens the time form in data add mode and sets the OpenArgs to the new ClientID.
DoCmd.Close acForm, Me.Name ' this line closes the new client form
End Sub
in form frmTime: (note the 2nd line which is not in the example. I present it here just as an option instead of the first line. The first line will dirty the record while the 2nd line wont)
Code:
Private Sub Form_Load()
Me.ClientID = Me.OpenArgs 'this line sets the ClientID to the value of OpenArgs. Note that it will instantiate a new record
'Me.ClientID.DefaultValue = Me.OpenArgs 'You can use this line instead of the above line and a new record wont be instantiated until you dirty the form
End Sub
the recordsource of frmTime is:
Code:
SELECT tblTime.HoursID, tblTime.ClientID, tblTime.StartTime, tblTime.EndTime, tblClients.FName, tblClients.LName, [FName] & " " & [LName] AS ClientName
FROM tblTime INNER JOIN tblClients ON tblTime.ClientID = tblClients.ClientID;
which looks like this in the QBE
You'll notice that the client table is joined to the time table by clientID. the last field in the QBE grid is the first and last name concatenated and aliased as ClientName. You then can use ClientName as a field on the form.
Hope this makes sense to you.
Good Luck