Gotorecord, , acNewRec

rtdc

Registered User.
Local time
Today, 20:03
Joined
Feb 27, 2007
Messages
55
I am probably being dumb but I am stuck on a silly problem, all I want to do is when my form opens its sub form which is set to datasheet is ready to add a new record so you can just type straight off.

The sub form record source is a string which works fine, this opens at the first record. My code is

Dim LA As String, AA As String, F As String, LAF As String, AAF As String
F = Me.Data_lst.Column(0)

'form data
LAF = "SELECT tbl_Accounts.Account, tbl_AccountList.Credit_limt, Sum(tbl_Accounts.Money_in) AS [In], Sum(tbl_Accounts.Money_out) AS Out " _
& "FROM tbl_AccountList INNER JOIN tbl_Accounts ON tbl_AccountList.Account_Name = tbl_Accounts.Account " _
& "GROUP BY tbl_Accounts.Account, tbl_AccountList.Credit_limt " _
& "HAVING (((tbl_Accounts.Account)='" & F & "'));"

'subform data
LA = "SELECT tbl_Accounts.* FROM tbl_Accounts WHERE (((tbl_Accounts.Account)='" & F & "'));"

DoCmd.OpenForm "frm_Accounts", acNormal
Forms![frm_Accounts].RecordSource = LAF
Forms![frm_Accounts]![frm_Accounts_SubDatasheet].Form.RecordSource = LA

This is all working fine. What I am trying to do is

Forms![frm_Accounts]![frm_Accounts_SubDatasheet].Form.GoToRecord , , acNewRec

This does not work, what am I doing wrong to have the subform datasheet got to a new record or just the last record?

Cheers.
 

Users who are viewing this thread

Back
Top Bottom